How does one know when another player's customProperty changed?

Options
Hi! When using PhotonNetwork.SetPlayerCustomProperties(properties), the documentation says it also updates the value for others. My question is, how can I know on the other client when a property of the other player changed? Is there some kind of event I can subscribe to, e.g. in OnEvent(EventData photonEvent) in my MonoBehaviourPunCallbacks object? Thanks!

Comments

  • Philipp
    Options
    I just realized it's event PropertiesChanged, (byte) 253, in above-mentioned OnEvent().

    All is solved then for now, I'm leaving this thread for anyone who might stumble on it in search looking for the same answer.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @Philipp,

    There is OnPlayerPropertiesUpdate which is the callback for local or remote player's properties changed event.
  • Philipp
    Options
    Great, that's even better! Thank you!
  • Philipp
    Options
    Sorry, where would I put the OnPlayerPropertiesUpdate()? (I have a Person object which derives from MonoBehaviourPun, and includes a photonView.Owner, but in that Person class it won't fire.)
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Implement IInRoomCallbacks in Person and do not forget to register and unregister callbacks as shown here or here.
  • Philipp
    Options
    Thanks! (It looks like the IInRoomCallbacks are of a more global, above-Person nature, so if I implement this approach I might move them to my generic network handler where I'm currently already handling the PropertiesChanged PropertiesChanged.)