Reloading Level - Don't Reload Object If It Already Exists

I’m working on a game where I’ll have to reload existing levels/scenes depending on the situation (game over, for example). Some objects I have set to not destroy on load (DontDestroyOnLoad()) but this means they will be recreated if I return to the level and I will have 2 of them (or more). Currently my solution is to destroy them if game over occurs, but with checkpoints later in development, this won’t make sense.

How can I say “if this object already exists, don’t create it”?

No you can’t - but you can destroy the new one immediately


   public static MyClass instance;

   void Awake()
         if(instance == null)
               instance = this;