Trigger event from plugin

Sujeto 4 years ago updated by Lazlo Bonin (Lead Developer) 3 years ago 9

Hey! i recently added Koreographer to my Project with bolt, i added it's dll to the assembly options but whent the time came to trigger the events koreographer is sending in bolt i dont know what to do, this is the code i want to replycate in bolt:

using UnityEngine;
using SonicBloom.Koreo;
public class EventSubscriber : MonoBehaviour
// Use this for initialization
void Start()
Koreographer.Instance.RegisterForEvents("TestEventID", FireEventDebugLog);
void FireEventDebugLog(KoreographyEvent koreoEvent)
Debug.Log("Koreography Event Fired.");

So firts i need to initialize the register for events node with the start  event, but it ask for a callback and i dont know what to put in there

I imagine it should be the "void FireEventDebugLog"

line, but i dont know how to translate it to bolt, and then the problema is how to actually trigger the koreography actions ... so that... thanks! 

Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):

Bolt currently doesn't have a mechanism for callbacks, as it doesn't generate executable code.  That's coming in version 2, at which point it should be able to satisfy the delegate needs of 3rd party software.

In this case, you aren't going to get away from a little code.  You're going to have to either create the callback from code and store it as a type, or perform the RegisterForEvents call from code itself.  However, once you do, you can just make the callback immediately call back into Bolt using a Custom Event:


If you need help with either of these approaches, let me know, I've had to do this somewhere and can dig up the code.

Thanks for the answer! that is good to know how that Works, i think i'm going to give it a try by myself this weekend if i cant then i will let you know. Thanks again! i really appreciate it!


Hi Sujeto,

Sorry for the late reply on this.

Reality.Stop() is right, because callbacks / delegates aren't available yet, you'll have to resort to a bit of scripting.

Eric Robinson from Koreographer posted the right solution to their forum thread. You'll need to create an event subscriber component that forwards Koreographer events to Bolt:

using UnityEngine;
using SonicBloom.Koreo;
using Bolt;
public class EventSubscriber : MonoBehaviour
    [Tooltip("The Event ID for which to register for events.")]
    public string eventID;
    void Start()
        Koreographer.Instance.RegisterForEventsWithTime(eventID, TriggerBoltEvent);
    void TriggerBoltEvent(KoreographyEvent evt, int sampleTime, int sampleDelta, DeltaSlice deltaSlice)
        CustomEvent.Trigger(gameObject, "Koreographer", evt, sampleTime, sampleDelta, deltaSlice);

After this, you should place a Custom Event unit in your graph and set its name to "Koreographer" to receive the event. Give it 4 parameters (one for each passed in the script). (More info about this here).

If you want to access the members of KoreographyEvent and DeltaSlice, you'll need to add them to your custom types. Information on how to do this here.

Let me know if that works for you!

I'm attempting to test this out and I am not sure where to put the Event ID. There's a tooltip in the code, but where does that show up?

Will this allow for every event to fire or just one specific defined one? I have some other question too, but don't want to bombard you.


Will this allow for things to happen across all the events on the track with that ID?

Do I need something similar to this? 

That music test has a Koreography component on it and the Event ID is test-track1

Yes, that's the correct setup.

This will only work if you trigger your event on the "Music test" object here.

If you want a global event, the current workaround is to send & listen on a singleton object in the scene

Hello there!

Quick follow-up. I've got my flow subscribing to events and have added the custom types, but I'm having difficulty working out how to access the payload information. Specifically, I'm trying to access the string of the text payload that's being passed here. 

I can access the type (textPayload) but not the contents... I'm sure this is something simple, but I'm a bit of a noob.... If anyone could give me a pointer I'd really appreciate it!

a little more on this...

So, in the documentation ( http://argos.vu/wp-content/uploads/2016/05/Koreographer-Users-Guide-1.pdf (page  ) it references being able to call a method " for example, you could use the Koreopgraphy event GetColorValue method to retrieve the coloraturas value stored in a payload instance". 

I'm not seeing those methods exposed when I add the Koreography event node though... should I? 

It's the text payload I'm trying to access, so I was imagining there would be a GetTextValue method?

thanks again!

Hi Mr Simmo, sorry for the late reply, I was on holiday break!

I see Eric from Koreographer answered on their forum, so I'm assuming this was resolved? Feel free to comment here again if you need any further help.