Stopping U3D in the callback will get stuck

#1

I don’t know how to solve this problem. I’ve had very short access to this plug-in. Now I want to play several music sequentially, and now I save it in a list. (Forgive me for not knowing how to use this plug-in regularly, if you have a better way, I hope you can tell me), and then use callback monitoring, like this [dialogue Callback, EVENT_CALLBACK_TYPE.DESTROYED]] It works well, but when I close it Unity3D gets stuck before the callback event is executed. My English is poor. I’m sorry.

FMOD.Studio.EVENT_CALLBACK dialogueCallback = new FMOD.Studio.EVENT_CALLBACK(DialogueEventCallback);

static FMOD.RESULT DialogueEventCallback(FMOD.Studio.EVENT_CALLBACK_TYPE type, FMOD.Studio.EventInstance instance, IntPtr parameterPtr)
{
Debug.Log(“SAudioDataLoadState”);
BgMisicEntity.GetInstance().PlayMusic(“event:/down2D”);
return RESULT.OK;
}

public void PlayMusic(string audioName)
{
_bgmList = new List() { audioName };
_eventInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE);
_eventInstance = RuntimeManager.CreateInstance(_bgmList[0]);

_eventInstance.setCallback(dialogueCallback, EVENT_CALLBACK_TYPE.DESTROYED);

_eventInstance.start();
_eventInstance.release();

}

Now when I execute PlayMusic, the sound will be played back and forth, and when I stop running, Unity3D will be stuck.

#2

Have a look at our Timeline Callbacks example, make sure you are freeing any pinned memory. Most platforms will also require [AOT.MonoPInvokeCallback(typeof(FMOD.Studio.EVENT_CALLBACK))] attribute on he callback function.

#3

thank you for your help