When are Player CustomProperties available?

Options
Hi,

We are encountering a situation where it seems Player customProperties are not always available immediately. The scenario is something like this:

- Player A joins a room
- Player A sets a custom property '1'
- Player B joins the room and immediately reads custom property '1' from Player A, but property is not set.

We are still trying to diagnose this, so my questions are:

When are player custom properties synced or guaranteed to be available? Can we read them immediately after we join a room? Should we wait for some event first?

Thank you,

S

Answers

  • Tobias
    Options
    The player properties should be available when you joined a room.
    The fine print is that PUN needs to get a few updates first. It's easy to figure out when you joined a room, as PUN will call OnJoinedRoom(). So when this is called, you should have to props.
    Another caveat: When the new client joins while the other sets it's props, then those are not necessarily available in OnJoinedRoom(). So, also look out for changed props via OnPhotonPlayerPropertiesChanged().

    The callbacks and how to implement them is described in the enum PhotonNetworkingMessage.