Hello guys.
I’m constantly having problems with stopping a snapshot in my projects and I honestly fail to understand why.
I have a simple pause game situation where I pause the events and want to smooth it out with nice fades by applying a snapshot. The thing is starting the snapshot works, but stopping doesn’t, so after I unpause the game, the events still aren’t heard.
The code is:
private void PauseMusic(bool paused) { SoundEvent.setPaused(paused); BackgroundMusicSoundEvent.setPaused(paused); if (paused) { SnapshotEvent = FMODUnity.RuntimeManager.CreateInstance("snapshot:/PauseGame"); SnapshotEvent.start(); isMusicPaused = true; } else { if (isMusicPaused) { SnapshotEvent.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); SnapshotEvent.release(); isMusicPaused = false; } } }
and then I trigger the function like this:
if (currentPlayer.Pause.Active) PauseMusic(true);
else PauseMusic(false);
Any help, please?