STOPPED vs STOPPING When Using Studio Event Emitter

Hi all!

Using FMOD 2.02.05
Using Unity 2021.2 LTS

I have a need to wait for an event to be fully stopped before changing scenes. The event in question has an Envelope on the master volume to allow a fadeout and it was being controlled via the Studio Event Emitter component. However, I discovered that the IsPlaying() check returns false as soon as Stop is called on the event; it does not seem to distinguish between the STOPPED and STOPPING playback states.

I attempted to use the following:

FMOD.Studio.PLAYBACK_STATE playbackState;
emitterInstance.EventInstance.getPlaybackState(out playbackState);

When using Debug Log it never returned STOPPING, only STOPPED, PLAYING, and STARTING.

I was able to fix the problem by manually creating the event instance using FMOD.Studio.EventInstance which when using getPlaybackState() did distinguish between STOPPED and STOPPING.

Is there a way to do this with the Studio Event Emitter or is my solution for manual creation the only way to go?

Thanks so much!

The event emitter is a bit tricky to use if you are performing more complex tasks such as checking playback state. This is because the event emitter creates event instances when it’s played and getting a proper playback state can be a bit tricky depending on when you are checking the state.

I would recommend sticking with doing the manual scripting method for accurate readings. You can use the new FMODUnity.EventReference to get the event browser in your script’s component in the Unity editor.

That’s great to know! Thanks Richard!