Player persistence between scenes?

I’m not sure if I missed this topic earlier in the course when we created our 2nd scene, but how should we handle player persistence between scenes? I don’t think it makes sense to have two separate instances of the Player prefab across the two scenes, because we want health/inventory/etc to carry over. However, I also don’t think we’ve tagged our Player as “DontDestroyOnLoad” (again, unless I missed this earlier in this section, which is probably the most likely answer :slight_smile:).

Right now, if I’m following correctly, when we load our 2nd scene we are simply searching for the instance of the player prefab that we already put there and moving it to the portal spawn point, and the player instance from our Sandbox1 scene is destroyed.

That’s actually coming in the Saving sections. When transferring between scenes, we will be saving the state of all of the characters in the scene including the player. In the next scene, the data from the save file will be transferred to the player.

Don’t worry, it will all make sense in a couple of sections.

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

Privacy & Terms