Timeline callback example has wrong signature

Hi I’m seeing an issue in the Timeline Callback example for the unity integration here: Scripting Examples | Timeline Callbacks

When copying this example into my project I get an error No overload for 'BeatEventCallback' matches delegate 'EVENT_CALLBACK'

It appears as though the signature for FMOD.Studio.EVENT_CALLBACK is EVENT_CALLBACK_TYPE type, IntPtr _event, IntPtr parameters

But in this example it is listed as FMOD.Studio.EVENT_CALLBACK_TYPE type, FMOD.Studio.EventInstance instance, IntPtr parameterPtr

Is there something I’m missing here? How can I properly hook up a Timeline callback in version 2.1

Replace the parameter FMOD.Studio.EventInstance instance in BeatEventCallback with IntPtr instancePtr. Add FMOD.Studio.EventInstance instance = new FMOD.Studio.EventInstance(instancePtr); direct below in the static method, then it will work.

2 Likes

Thank you that fixed it.
Perhaps the documentation should be updated as well.

Thanks for bringing that to our attention, I’ll get that corrected for our next release.

Heads up that I think this still hasn’t been corrected

Looking at our revision history, it looks like it was fixed up shortly after my comment above. You can see the creation of the EventInstance handle here, initialized from the callback’s IntPtr.