Setting CustomProperties for inactive players, overridden when player gets active. Photon PUN bug?

In our game we need to set custom properties for players that are inactive. Of course this works just fine. But when the inactive player gets active again after .ReconnectAndRejoin() he receives his old properties. So all the properties that were set when he was inactive get overridden.

This problem is also discussed here: (the fix suggested doesn't work) https://forum.photonengine.com/discussion/12284/setting-custom-player-properties-for-a-player-who-is-in-background-from-other-players

We are using: Photon PUN 2.4

Comments

  • JohnTubeJohnTube mod
    edited November 1
    Hi @Burny123,

    Thank you for choosing Photon!
    Sorry for the inconvenience, could you try the following fix:

    In "Photon/PhotonRealtime/Code/LoadBalancingClient.cs", inside "OnOperationResponse" method replace:
    Hashtable allProps = new Hashtable();
    allProps.Merge(this.LocalPlayer.CustomProperties);
    allProps[ActorProperties.PlayerName] = this.LocalPlayer.NickName;
    with:
    Hashtable allProps = new Hashtable();
    if (!this.enterRoomParamsCache.RejoinOnly)
    {
        allProps.Merge(this.LocalPlayer.CustomProperties);
    }
    // TEMPORARY: in case of rejoin, keep the next line to force "Broadcast" i.e. include actor properties in the JoinEvent, however this could revert changes made to the rejoining actor's NickName while he was inactive 
    allProps[ActorProperties.PlayerName] = this.LocalPlayer.NickName;
  • Hi John, this fix seems to work. Thanks!
Sign In or Register to comment.