Properties&objects synchronization when a new player enters the room

  1. How can a new player see other players' custom properties as soon as they enter, rather than when the properties are updated again? For example, if player A has 10 kills, new players will see 10 as soon as they enter, instead of seeing 11 after Player A has 1 more kill. It seems to me that custom properties can only be received by other players when they change.
  2. How do I synchronize objects in the scene? For example, if a box is broken in a scene, how will a new player see the box broken when he joins? Which mode of PhotonView is more appropriate?

Answers

  • Thanks in advance! I'm a beginner😵

    1. When players enter a room, they get everyone's properties, so they are available in OnJoinedRoom(). You could assume that values are 0 (or default) for any property a player did not set yet.
    2. I think I would do that with properties. It depends a bit on how many boxes there are and so on but .. in general, Custom Room Properties should do the trick.
  • Thanks for your answer!

    By the way, should I use

    SetCustomProperties(Hashtable propsToSet)

    to change the properties of a box in the scene? What if there are plenty of boxes?

    And how can a new player get the value of the box which has existed in this room for a long time? Can I use custom data instantiation in OnJoinedRoom()?