How can I know when sound playing finish


(captals) #1

I see there is a method named setCallback in class EventInstance can pass parameter EVENT_CALLBACK_TYPE.STOPPED cause a call when sound playing finish.But this callback is in another thread, not in unity main thread.I’m afraid this callback will cause my game crash,because unity does not support multi thread call unity api.


(Nicholas Wilcox) #2

You are correct that STOPPED callbacks will come from another thread. There is nothing that can be done about it. You either need to deal with multi-threading issues yourself. Or you call poll EventInstance.getPlaybackState (http://www.fmod.org/documentation/#content/generated/FMOD_Studio_EventInstance_GetPlaybackState.html) from the main unity thread.