Master Client Player Custom Properties

Ok, something very confusing is happening to me.

I have a variable inside Players Custom Properties that I set to Null to reset it.
I set the custom properties and it disappears only to reaper on only one client the Master Client.
So for every other player, its fine but one Master Client will get this value back out of nowhere in 1-2 seconds after the reset. Can someone tell me whats going on here?

Comments

  • JohnTubeJohnTube mod
    edited November 2017
    Hi @Fiercy,

    Are you using the latest version 4.1.1.17?
    I don't know what you mean by "reset" but how do you create rooms? Do you set roomOptions.DeleteNullProperties = true?

    Tell us exact steps to reproduce the issue, in order and with enough details.
    And maybe add logs to the calls to set properties calls to spot anything you might have missed.
  • FiercyFiercy
    edited November 2017
    I am using the latest Photon-Unity3D-Sdk_v4-1-1-17
    I added that room option but it didn't help ( I am not adjusting room custom properties but rather the player ones)

    this is the code that I have
    Hashtable playerData = LocalPlayer.CustomProperties;
            Debug.Log("Player Subtract Chips Reset" + " From " + LocalPlayer.NickName);
            LocalPlayer.CustomProperties[GameConstants.PLAYER_CHIPS_SUBTRACT] = null;
            LocalPlayer.CustomProperties[GameConstants.PLAYER_CHIPS_ADD] = null;
            Debug.Log("Player properties set");
            LocalPlayer.SetCustomProperties(LocalPlayer.CustomProperties);
    
            if (LocalPlayer.CustomProperties.ContainsKey(GameConstants.PLAYER_CHIPS_SUBTRACT))
            {
                Debug.Log("Chips to subtract still here");
            }
            else
            {
                Debug.Log("There is no chip subtract key");
            }
    It works on all clients but the Master Client.

    On master client I do get the "There is no chip subtract key" but it's reset to value it was in a 1 second.
  • JohnTubeJohnTube mod
    edited November 2017
    If you set roomOptions.DeleteNullProperties = true properties, room and actor, (game or player) will be deleted server side when you set their value to true.

    By default on client properties with null values are deleted or never cached.
    So in all cases, if you really use the exact same code, you should always see "There is no chip subtract key".

    This is not how you should update properties, here is how I think it should be done:

    Hashtable playerData = new Hashtable(2); Debug.Log("Player Subtract Chips Reset" + " From " + LocalPlayer.NickName); playerData.Add(GameConstants.PLAYER_CHIPS_SUBTRACT, null); playerData.Add(GameConstants.PLAYER_CHIPS_ADD, null); Debug.Log("Player properties set"); LocalPlayer.SetCustomProperties(playerData);
  • Well, the thing is these 2 properties aren't the only ones I have so if I do something like this what will happen to the others?

    I have added the delete null properties option but I still have the same problem it works everywhere but Master Client ( The player Who Starts the Game will get the value back) in 2 seconds after I've reset it.
  • JohnTubeJohnTube mod
    edited November 2017
    if I do something like this what will happen to the others?
    Nothing. The other properties will remain untouched.

    but Master Client ( The player Who Starts the Game will get the value back) in 2 seconds after I've reset it.
    You probably have a call to SetCustomProperties on MasterClient that resets those values. Double check your code.
Sign In or Register to comment.