Timeline callback and main thread communication


I’ve set up a timeline callback per beat as such

and the callback signature

static FMOD.RESULT TestEventCallback(FMOD.Studio.EVENT_CALLBACK_TYPE type, FMOD.Studio.EventInstance instance, IntPtr parameterPtr)

Now I am checking some input (main thread) and would like to read some data in this callback thread. (I’m assuming the callback will be on a different thread) I’m not sure how, if at all, I can communcate or pass some data from my main thread (or monobehavior) to a callback or vice versa. Is there a pattern or a best practise here? My use case is that I want to react to things happening on a beat, logic that needs to be performed in monobehaviors.


We have a couple of examples that use callbacks, the Timeline example uses the information from the callback by passing information through the EventInstance.setUserData.