We want to make sounds (all sounds) fade when game pauses. Not stop abruptly, but fade. Any idea where to look at?
I know how to fade sounds in game, but when it pauses AC stops sounds automatically.
Thanks.
AC doesn't directly pause sounds when the game is paused - it's built-in behaviour of any Unity AudioSource that doesn't have ignoreListenerPause checked.
If you want to run some custom code at the time the game is paused, you can do so by hooking into the OnEnterGameStatecustom event, i.e.:
For audio to fade out when paused, you'd have to enable ignoreListenerPause and then manually pause the sound once the fade out has completed. You'll make things easier for yourself if you instead fade out the sound and then pause the game.
One way to do this would be to play audio through Audio Mixer Groups, and then apply a Mixer Snapshot using Actions to transition to a snapshot that makes the audio silent, just before pausing the game.
Comments
Sound: Play action set Fade out time there.
AC doesn't directly pause sounds when the game is paused - it's built-in behaviour of any Unity AudioSource that doesn't have ignoreListenerPause checked.
If you want to run some custom code at the time the game is paused, you can do so by hooking into the OnEnterGameState custom event, i.e.:
For audio to fade out when paused, you'd have to enable ignoreListenerPause and then manually pause the sound once the fade out has completed. You'll make things easier for yourself if you instead fade out the sound and then pause the game.
One way to do this would be to play audio through Audio Mixer Groups, and then apply a Mixer Snapshot using Actions to transition to a snapshot that makes the audio silent, just before pausing the game.