I’m not sure if it is a bug or anything, but I have an Audio Source in my scene which is playing my background music. The Audio Source is set with “Play On Awake” and “Loop” at true. The first time I’m launching my scene, the music won’t play. However, it will start playing if I’m loading my scene a second time thanks to a button. I do not use this Audio Source in the code except to stop it if my character dies, so it is referenced in a Audio Manager script.
Now the real strange thing is that, when the scene is not played and I’m editing it in Unity, the Audio Source will randomly starts to play. I’ve been looking everywhere, and I am maybe missing something stupid, but I can’t figure why this is happening.
Does anyone know what could trigger such behavior ? I guess the two problems are connected, but I can’t figure how.
(I have already solved the problem for myself by deactivating the “Play On Awake” and using AudioSource.Play() in my Start function instead, so it seems it is coming from the “Play On Awake” choice there.)
Isovald, I came here to say exactly what you said. I’m running Unity 5.3.4.f1 Personal. I have a GameObject with an Audio Source component attached with ‘Play On Awake’ selected.
This Audio Source plays when I’m not in play mode. I know that it’s this particular audio source because if I disable the component it stops. If I disable the containing game object, it stops. Also if I press the pause button while not in play mode it stops.
It seems to me that my game object is awake even though the scene isn’t being played.
I have resorted to just disable the component until I want to test.
I have the exact same issue 5.4.0f3. When the scene is not running, the audio source plays, when the scene runs, the audio source stops.
I have deleted that gameobject, but as soon as I create a new gameobject with an audiosource, it will start playing again.
It’s like a possessed audiosource that will re-posses any new ones I create. As far as I know, audiosources don’t normally play when the scene is not running, so this is strange.
Found the problem.
This was making me crazy, and the pause button was not a solution, this happens when in the scene view the audio icon is pressed, when pressing it again, the background music loaded will go away.
Hope this helps for your problem @Isovald @t36k @Arctel