New game isn't reloading gameobjects that had a Don'tDestroyOnLoad method and then were destroyed.

My game has a gameobject that has a DontDestroyOnLoad method. I also have a pause menu that can access the main menu which is in a difference scene. My problem is that if I access the main menu from the pause menu then the gameobject carries over into the main menu scene. Yet if I destroy the gameobject, when clicking the new game button which loads the main scene then the gameobject is still destroyed.
How would I go about resetting my main scene when I access it from the main menu so then the gameobject is created again?
Thank you.

Tip one: Don’t destroy a GameObject that you don’t want destroyed. :wink:

I tend to have a lazy service instantiation script in every scene. It checks for the presence of the services scene, and then loads it if its not present. It makes it really convenient for play testing, as I can start the game from any point and the appropriate services will be loaded.

1 Like