I think I have found a bug in the AudioListener that gives an error when I use the pause function. I will prepare a bug report and hope it is fixed in the next version, but before then I was hoping someone might have encountered it or be able to suggest a workaround.
The error happens consistently on the iPhone and occasionally in the Editor, when I use AudioListener.pause. In the editor I receive the error: AL_Invalid_Value, sometimes specifying an AudioSource. This code produces it sometimes:
function PauseGame(){
AudioListener.pause = true;
savedTimeScale = Time.timeScale; //Save timescale to be restored later
Time.timeScale = 0;
...
}
and in this code it happens when I move from the main scene to another scene if a sound was playing before pausing:
function OnLevelWasLoaded(){
Time.timeScale = 1;
AudioListener.pause = false;
enabled=false;
}
I know it is the AudioListener causing the problem because if I comment out those lines the crashes stop, and when no sound files were present there were also no crashes.
I have tried making sure the AudioListener is always unpaused before changing scenes, or changing the timescale, but that did not help. There is always 1 Listener in the scene. Does this make sense to anyone?