Persisting Room Object between levels
Options
Hi,
I used InstantiateRoomObject to create objects representing games and players. I have multiple Scenes that players use to customise these objects before playing the game, so I'd like these objects to stay available even when I load a different level.
From what I've read in the documentation it sounds like these room objects exist until destroyed, or the room is destroyed, so calling PhotonNetwork.LoadLevel shouldn't destroy them. Have I understood that correctly? If so that leads to my next question, how should I access the room object in the next scene, as it doesn't appear in my Scene Hierarchy.
Thanks for reading.
I used InstantiateRoomObject to create objects representing games and players. I have multiple Scenes that players use to customise these objects before playing the game, so I'd like these objects to stay available even when I load a different level.
From what I've read in the documentation it sounds like these room objects exist until destroyed, or the room is destroyed, so calling PhotonNetwork.LoadLevel shouldn't destroy them. Have I understood that correctly? If so that leads to my next question, how should I access the room object in the next scene, as it doesn't appear in my Scene Hierarchy.
Thanks for reading.
0
Best Answer
-
Yes per client.0
Answers
-
After looking into the source files, it seems that despite being called room objects, they have to be destroyed when the scene changes. I think the old name of "scene objects" describes them better, but there you go.
I guess that means I'll have to hope that Custom Room Properties is enough to hold all my player data. If there is a way to keep an object into the next scene, like DontDestroyOnLoad, then please do let me know!0 -
Oh really? I'm guessing I have to do that for every client?0
-
Yes per client.0
-
That's working perfectly. Thank you very much!0