** CAN'T FIGURE OUT Player Custom Properties **

HI! … the following class is attached to an empty object in a scene… when the Start() runs (upon entering a PHOTON Room via LoadLevel of the scene)… it seems the “Tag” is NOT setup to “value”… and is just blank (not sure if it is “”):
.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using Hashtable = ExitGames.Client.Photon.Hashtable;

public class TestCustomProperties : MonoBehaviourPunCallbacks
{
void Start()
{
Hashtable hash_in = new Hashtable();
hash_in.Add(“Tag”, “value”);
PhotonNetwork.LocalPlayer.SetCustomProperties(hash_in);

string tag_value = (string)(PhotonNetwork.LocalPlayer.CustomProperties[“Tag”]);

Debug.Log("Tag Value = " + tag_value); // tag_value is BLANK!
}
}

the result of the Debug.Log() line is:
.
Tag Value =
.
any idea what is wrong?

ok… figured something out… it takes TIME for the Custom Properties to take effect after SetCustomProperties… is there a way to know when this happens (like a callback?)
.
the reason i know this is i also put the:
.
string tag_value = (string)(PhotonNetwork.LocalPlayer.CustomProperties[“Tag”]);
Debug.Log("Tag Value = " + tag_value); // tag_value is BLANK!
.
in the Update method… and the 5TH time it did Update the Tag was indeed set to ‘value’…

so… my (kind of odd solution) is to have a CustomProprties Key i setup via SetCustomProperties called “Valid”… then set it to “yes”… and poll to see if “Valid” = “Yes” and then i will know it has been updated…

does anybody know a means to tell when the values of a SetCustomProperties action actually go into effect?.. like a OnCustomPropertiesUpdated()?.. having the old values stay in place for multiple Updates() is a bit annoying… :slight_smile:

They are updated by the server (basically confirming them), by default.
Have a look at the doc for a summary of how to use them and the callbacks.

The paragraph “Properties Synchronization” also explains how to get the properties changed immediately, as in PUN Classic (spoiler: set roomOptions.BroadcastPropsChangeToAll to false).

thanks!.. i will look up these concepts! :slight_smile: