Why does gameobject need to be destroyed at end of Transition?

I don’t quite understand why the gameobject (Portal) needs to be destroyed at end of Transition() function. How is the player able to reenter that portal after it has been destroyed in the scene?

The portal we destroy is the portal from the previous scene. We add it to DontDestroyOnLoad so that it stays around (and the code continues to execute) after the new scene was loaded, but once the code has completed we no longer need the portal so we destroy it. The player will reenter through different portals that are placed in the new scene. A portal transition is made up of 2 portals: One in the current scene and one in the target scene. The portal we destroy is the one from the current scene, which is no longer the current scene after the transition

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.