RPC Synchronization of the Room

Options
Hello,
I'm using Photon Unity Networking and I am working on a little game of mine.

I got to a point where I have a room with players and mobs.
When a new player appears I use RPC call to update information about this player to all other connected users to get synchronized.
The problem is.. that this new player does not have any information about the rest of the room (his info is not up to date).
I mean for instance current health of other players, or current health of mobs, etc.

The only only solution I came up with is to send an RPC to a master client, pass through all volatile objects around and send several RPC calls back to the new player with this update.

What I am asking is... do I really have to it like this? Or is there any other way, any better or simpler way?

Comments

  • vadim
    Options
    If you sync objects state via RPC, handle OnPhotonPlayerConnected and send RPC with current state to joined player.

    Also you may try player custom properties for values which should be stored per player. You set local player properties in one client (PhotonNetwork.player.SetCustomProperties) and get them automatically in all others by iterating players list (PhotonNetwork.otherPlayers -> player.customProperties).