[Help] PhotonNetwork.LocalPlayer.SetCustomProperties didn't work after joined room
Options
ExitGames.Client.Photon.Hashtable PlayerInfo = new ExitGames.Client.Photon.Hashtable()
{
{"Name","this is a name"}
};
PhotonNetwork.LocalPlayer.SetCustomProperties(PlayerInfo);
Debug.Log("this is CustomPropertise:" + PhotonNetwork.LocalPlayer.SetCustomProperties(PlayerInfo));
object name;
Debug.Log("this is CustomPropertise:" PhotonNetwork.LocalPlayer.CustomProperties.TryGetValue("Name", out name));
I Tset the same code, before i join room this code works and i can get the value,but after join room(Or in game),However Debug.Log("this is CustomPropertise:" + PhotonNetwork.LocalPlayer.SetCustomProperties(PlayerInfo)) is true but TryGetValue is false.
[img]file:///C:/Users/%E6%A2%81%E5%AE%98%E7%8E%89/AppData/Roaming/Tencent/QQ/Temp/M9JYOH(]L]AJ1PFE8@MA8ZC.png[/img]
{
{"Name","this is a name"}
};
PhotonNetwork.LocalPlayer.SetCustomProperties(PlayerInfo);
Debug.Log("this is CustomPropertise:" + PhotonNetwork.LocalPlayer.SetCustomProperties(PlayerInfo));
object name;
Debug.Log("this is CustomPropertise:" PhotonNetwork.LocalPlayer.CustomProperties.TryGetValue("Name", out name));
I Tset the same code, before i join room this code works and i can get the value,but after join room(Or in game),However Debug.Log("this is CustomPropertise:" + PhotonNetwork.LocalPlayer.SetCustomProperties(PlayerInfo)) is true but TryGetValue is false.
[img]file:///C:/Users/%E6%A2%81%E5%AE%98%E7%8E%89/AppData/Roaming/Tencent/QQ/Temp/M9JYOH(]L]AJ1PFE8@MA8ZC.png[/img]
0
Comments
-
It really bothered me for a long time0
-
I Try to keep data during games0
-
when getting customProperties its a good rule of thumb to use OnPlayerPropertiesUpdate to get which properties have been updated, and update accordingly (especially if it will affect other players).
Look at AsteroidsGameManager in the demo they provide for good reference to how this can be achieved through their CheckEndGame function0