I know it’s been many times here but I still can’t find the solution. I’ve checked the usual suspects. But first things first - I have a scene, some objects in it, including AudioSource
’s, and one AudioListener
attached to the main camera. I want to mute all sounds after clicking the button with the following code (I hope it’s self-explanatory):
AudioListener.volume = GameState.sound ? 1.0f : 0.0f;
But the sounds still play (music too). Usual suspects: more than 1 AudioListener
(checked, I have only 1), AudioSource
’s have ignoreListenerVolume
set to true
(also not the case).
Interestingly enough, AudioListener.pause
works, but that’s not what I need.
I’ve checked in the debugger the quoted line of code and AudioListener.volume
is always 1
before the execution of that line. So it somehow resets itself but I don’t know how.
Any ideas, please?