OnRoomPropertiesUpdate has stale local data

Options
Hi,

Using PUN 2 (am unsure if this was also an issue in 1.x) ...

After calling SetCustomProperties on a room a few times in a row with different values, shortly after the OnRoomPropertiesUpdate callback fires on the local client with the oldest of the values, which is obviously out of date.

For example:

Frame 1: PhotonNetwork.CurrentRoom.SetCustomProperties is called with Hashtable key = "q1" value = "Red"
Frame 2: PhotonNetwork.CurrentRoom.SetCustomProperties is called with Hashtable key = "q1" value = "Blue"
Frame 4: OnRoomPropertiesUpdate callback is received with Hashtable key = "q1" value = "Red"
Frame 5: OnRoomPropertiesUpdate callback is received with Hashtable key = "q1" value = "Blue"

To emphasise, this occurs with just a single client. On frame 4, the problem is that the value of q1 in the customProperties table is set back to Red again, even though the local client had recently set it to Blue.

On remote clients this makes sense of course, because they receive the changes in order only when they know about it (i.e. goes Red then Blue). But on the local client it's just wrong ... it goes Red,Blue,Red, Blue.

Surely if the custom properties are received only from the local client, the most recent locally set value should take precedence ?

Thanks,

Adrian

Comments

  • Hi @twistplay,

    Surely if the custom properties are received only from the local client, the most recent locally set value should take precedence ?


    The client does not know who changed the Custom Room Properties, so he applies everything he receives from the server. Since he has already updated the values locally, he will do it twice. The Custom Room Properties are not designed to be updated that frequently.

    If there are multiple clients in the room who want to change the Custom Room Properties at more or less the same time, there is the Check And Swap for Properties option, which prevents such cases. You can read about that option on the Synchronization and State documentation page.