AudioListener crashing when setting pause to false

When I mute the game I set:

AudioListener.pause = true;

Then when I unmute it I set:

AudioListener.pause = false;

Except that when I set it to false I get the error:

m_PausedSources.empty()

Any idea what’s going on? Anyone?

PS: This post wont let me use the tags I want because I don’t have enough reputation, won’t tell me which ones I can use, and the suggested one are dead wrong, so I just one of the suggested ones.

As far as I know, the “m_PausedSources.empty()” thing is a bug…

However, you shouldn’t be using AudioListener.pause to mute sounds. It is designed for pausing sounds. So when you set it back to true, it will resume the sounds exactly where they left off, and also, any sounds that you started playing while it was paused, will now start playing.

A better approach would be to set the AudioListener’s volume to 0.

Ok, first of all I think you can’t put pause on false(I think). But a smarter thing to do is lowering its volume, this way you have more control and you can created fade-in/out effects.

edit: This method can also be used in an options menu to let the player control the ingame audio strength.

function Update(){

//muted
AudioListener.volume=0;

//un-muted/Play/Listen
AudioListener.volume=1;

}

//Remember you can't go above 1 as this is full open volume
//and you can't go below 0, 0 is complete silence.