Player destroyed when loading a new scene

Options
Hello Guys,

So what I am trying to do is when 2 players joined a room than I am loading a new scene called Gameplay and but in Gameplay scene player clones gets destroyed. So do I have to spawn players again in Gameplay?

Answers

  • Tobias
    Options
    Well. Loading scenes in Unity typically destroys the previously existing objects, yes.
    The alternative to not re-Instantiating the objects is to apply DontDestroyOnLoad(obj) to objects and to destroy them later on, when you don't need them anymore.
    Given that PUN 2 can use an object pool to instantiate from, you could also keep the destroy and re-instantiate.