- Home /
Question by
Jason-King · Oct 23, 2013 at 07:54 PM ·
loadleveldontdestroyonloadaudio source
Audio restarting during LoadLevel
Found a very interesting bug in unity...
Let's say you have a AudioSource attached as a child of a scene camera. But it is set with DontDestroyOnLoad, even though the parent camera is set to be destroyed. When a new scene is loaded, the audio source gets parented to the root. At that point, the AudioSource will be restarted.
So how can this be resolved?
Comment
I added this Q&A because it was actually more difficult to discover the specifics of the bug than fix it. Hopefully others looking for answers to why audio is restarting will now have the clue they needed.
Best Answer
Answer by Jason-King · Oct 23, 2013 at 07:56 PM
This bug can be worked around by simply resetting the parent to null before LoadLevel is called.
Your answer
![](https://koobas.hobune.stream/wayback/20220613120520im_/https://answers.unity.com/themes/thub/images/avi.jpg)