Saving player position in custom properties
Hey, I have a problem with reconnection. Now, when I reconnect/rejoin to the same room, the player can retrieve his properties and I can sync his score/kills etc on instantiation since I am saving those to the player properties each time I score/kill.
However, the issue that I am facing is when I am trying to save the position. How and where do I send player's position (to custom properties maybe) if he's continuously moving. I think updating player properties with player's position in update won't be a good Idea so where do I store the position that on reconnection I can retrieve it (like I do with kills/score) and the sync it to the player.
Thanks.
Comments
-
Photon has a disconnect handler which gives you detailed information about whether your disconnect was a client invoked one or whether it was a problem with network, before doing mop-up of the scene you can save the local player position one last time before everything is destroyed. See
OnDisconnected
for more info...Photon Unity Networking 2: MonoBehaviourPunCallbacks Class Reference (photonengine.com)
And yes you are right, don't spam custom properties if you can help it. Custom properties is an expensive call in relation to everything else due to it being broadcasted to the entire room and being a Hashtable.
1 -
What should be the best way to save the player position and on Rejoining, syncing the player to that position ?
0