Audio from new scene begins half way through loading.


So, I’m loading in a scene using Application.LoadLevel, and it all works fine, except for one thing. For some reason, the audio from the scene that is currently loading seems to start the moment the audio source has been loaded. This means I get atmospheric sound effects playing during loading. The really odd thing about this is that it seems to totally ignore the AudioListener’s state. I have tried both AudioListener.pause and AudioListener.volume = 0, and neither solves the issue (the sound does stop after the scene is loaded, but still plays during the loading period). Is there anything I can do to prevent this from happening?

Uncheck the box “Play on awake” on your AudioSource.
Then play the clip from script when the level has loaded.

I have fixed this! The issue arose because I was changing AudioListeners between scenes (I had a different camera setup in each scene, and it was easier to remove the camera than to attempt to change the scripts attached to it on loading the scene). This meant that, when I changed the volume of the AudioListener before loading the scene, it set the volume of the existing AudioListener. But, it then swapped that Listener for a new one, that I had no control over. Once I realised this, it was just a case of adding something along the lines of:

void OnLevelWasLoaded()
     AudioListener.volume = 1;

void Start () 
     AudioListener.volume = 0;

So the volume is set to 0 immediately after the AudioListener is created, and reset again once the level is fully loaded.