After calling DontDestroyOnLoad on a game object that we want to pass between levels. Eventually we want to finally destroy it... say to reset the game to the initial state.
Is there a way of undoing DontDestroyOnLoad without immediately destroying the object..
the command: Destroy(this.gameObject); will cause issues if other game objects that are in the same scene still depend on it. I just want it to get destroyed with all of the other game objects on the next level load.
asked May 26 '10 at 10:22 PM
No way to do it automagically no
best way i can think of doing it is this:
that way you get your object destroyed before the first update in the new level
answered May 26 '10 at 11:26 PM
If you're destroying it and it's then being recreated for the level you've just loaded to (I'm assuming this from your comment about destroy and destroyimmediate) why don't you make a reset method for the object that puts it back in its initial state.
That way you could just replace the destruction with a reset and carry on.
answered Jun 27 '10 at 12:06 PM