- Home /
DontDestroyOnLoad() not calling awake/start again
Is this intended behavior? How can I make it so it calls them again when the next scene loads?
Answer by Kryptos · Jan 20, 2012 at 08:42 AM
There is a Unity event called every times a new scene is loaded: OnLevelWasLoaded.
See: http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.OnLevelWasLoaded.html
Ahh those are the droids I was looking for. Thanks! I couldn't find it because I figured it was a member of Application.
Answer by Icelord · Jan 19, 2012 at 11:33 PM
Its normal behavior. DontDestroyOnLoad() prevents unity from deleting your selected objects + scripts when loading a new scene. So scripts keep the state & data they were in.
To make it call awake/start, i think the simpelest way is leave the DontDestroyOnLoad() and just add the scripts or make it initiate from a prefab ,in the next scene.