OnRoomPropertiesUpdate's propertiesThatChanged is always empty
Hi there, when I want to change a room value, I'll use the below method.
However, when I log the contents of propertiesThatChanged, it's always empty. Any idea what I'm doing wrong?
public void SetValue(RoomProperties key, int newValue) { if (Verbose) Debug.Log(string.Format("SetValue ( key: {0} , newValue: {1} )", key, newValue), this); var propertiesToSet = new Hashtable { { key, newValue } }; PhotonNetwork.CurrentRoom.SetCustomProperties(propertiesToSet); }When I do so, I get a response in the below method
public override void OnRoomPropertiesUpdate(Hashtable propertiesThatChanged) { if (Verbose) { Debug.Log(string.Format("OnRoomPropertiesUpdate ( propertiesThatChanged: {0} )", JsonUtility.ToJson(propertiesThatChanged)), this); foreach (DictionaryEntry dictionaryEntry in propertiesThatChanged) { Debug.Log(string.Format("{0} | {1}", dictionaryEntry.Key, dictionaryEntry.Value), this); } } }
However, when I log the contents of propertiesThatChanged, it's always empty. Any idea what I'm doing wrong?
0
Comments
-
Ah, the Hashtable you call SetCustomProperties with needs its key to be cast as a string. That fixed it for me.0