- Home /
pause the audiolistener of the main camera doesn't stop it from generating sound
I can get the AudioListener to be disabled but I can't get to be paused
listener = Camera.main.GetComponent(AudioListener);
If I use:
listener.enabled = false;
the component get deactivated on the main camera. But if I use:
listener.pause = true;
It doesn't stop generating sounds.
WHY ?
I found what was wrong. The audio was indeed stopping but I had another script somewhere that was callin function audio.play() I simply add a verification whether the game was paused or not before calling it and my problem got solved!!! I gess that audio.play() Unpause the AudioListener.
If you've found your problem post an answer to solve your problem. Always remember: this site is not just for you. It's a collection of good questions and answers so if somebody have a similar question he can find this one and get his answer.
Your answer
![](https://koobas.hobune.stream/wayback/20220613101530im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Mute/Unmute not working with new sounds 2 Answers
AudioListener.pause set to false when window loses focus 1 Answer
AudioSource.ignoreListenerPause ineffective? 0 Answers
Why does this bool get reset? 1 Answer
Why does Unity freeze for long periods when highlighting some objects in the hierarchy? 0 Answers