- Home /
AudioSource.ignoreListenerPause ineffective?
Hi.
Recently I've been experimenting with pausing and trying to make optimal user interfaces. I've got a simple pause screen that sets the Timescale to zero and a AudioListener that is put to pause as the player goes to the menu.
Luckily Unity has function named ignoreListenerPause that can play audio even if the listener is paused, or so I thought.
It seems that even a simple code as the following just doesn't seem to work, when I pause the game:
function Awake() {
audio.ignoreListenerPause = true;
audio.Play();
}
I've also made sure that the Play On Awake is unchecked in the AudioSource options, as some have said
There has been little to no discussion about this matter. Perhaps it has just gone unnoticed?
Is it a bug or am I just doing something plainly wrong? Can someone get this function to work?
If not is there are an alternative, so that I can play sounds in the menu mode?
Thank you!
EDIT:
Well I suppose that I should've done a little bit more research.
Before I just tried to play the sound in Awake() and pausing it in Update() function.
Now that I tried to play a sound on OnGUI() it worked just fine.
SOLVED!
Still, is there any explanation why the sound in the Awake function just didn't seem to play?
One of the possible reasons for it might've been that it was a 3D Sound that had its Pan Level set to zero.
If any of you know the answer for this and is ready to experiment, I would love to hear it.
Your answer
Follow this Question
Related Questions
Unity 5 and Multiple AudioListeners 2 Answers
Audio won't play sound 2 Answers
Audio listeners in multiplayer game 3 Answers
Change music during chase 1 Answer
Mute 1 audio channel while preserving spatialized 3D sound? 0 Answers