FMOD Event Instance across scene load

Hello, i wonder whats the correct way to stop an Event Instance from previous scene that keeps playing after a scene has been loaded. How can i keep the event instance reference persistent to stop it after loading the new scene?

Thanks!

Hi,

There are a couple of ways to do this, I think the easiest way is to get a reference to the Event Instance, then instead of stopping the Event when you change scene you will want to pause it so you don’t lose the instance handle using EventInstance::setPaused(). Pausing the sound while keeping a valid handle. Then on the script which contains the Event reference, you want to call DontDestroyOnLoad(this) which will keep the GameObject from being destroyed. Then in the new scene, you are able to play the Event again with setPaused().

Hope this helps!