Why player is not put in persistance object

Just out of curiosity, why is the Player prefab not into the PersistantObjectPrefab so a player prefab does not need to be placed into each different scene?

You technically could put the player in the PersistentObjectPrefab, but it would require that additionally, you either put the Camera rig in the PersistentObjectPrefab or have a method on the Player that can be called after the scene loads to assign the Camera’s follow and aim targets to the player.

One disadvantage to this is visualizing the player location in each scene as you edit it… you could just put a prefab with just the player model in each scene which would represent the starting spawn point (if the game isn’t loaded), and then that model can self destruct when the game actually Starts.

Are there any other benefits apart from being able to visualise the player position in the scene compared to adding the player prefab to the PersistentObjectPrefab? I know the “old player” will remain in the other scene with the current approach and the Transition code in portal will need to be updated for this to work though but it feels like it will save memory as less stuff will be in each scene initially (Player will be instantiated when the scene loads)

You won’t really be saving any memory. A scene has a player. That memory is used whether you put the player in the scene, or in the PersistenObjectPrefab.

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

Privacy & Terms