I am trying to pause all of the audiosources in the game scene when I pause the game. I already have the pause working where it sets the game time.timescale = 0 and everything online that I see to pause the game audio says to use
AudioListener.Pause()
I am trying to use this on the main camera but I cant find the .Pause or other methods like volume or play either.
Am I missing a library? I’ve tried the Audio library and that still didnt work.
You can Pause an AudioSource, not an AudioListener.
There’s also a global AudioListener.pause static property but that would preclude you from playing any sounds/music in a pause menu etc… unless you follow the docs and set “ignoreListenerPause” to true on those sounds.
Ok thank you so much! I tried this with pausing the audiosources themselves and it works perfectly. I may try this method in case I want to implement some pause menu music in the future!
Another way to mute audio would be to use AudioMixer. That way you could also add some cool effect to your audio, when you you pause the game (for example). Also this way you wouldn’t have to stop the background music, as it might sound repetitive if music restarts every time you pause and then restart your game.
I’ll definitely learn more about the AudioMixer! I am actually using it right now and have different volume levels for everything thats producing sound inside of the mixer already.