Reset player custom properties
Options
Hi,
I noticed that PhotonNetwork.player keeps customProperties even after disconnecting from Photon. I tried to reset properties by calling
To be more specific, here's the complete test code piece:
Log shows me 2 in the console. How can I nullify custom properties?
I noticed that PhotonNetwork.player keeps customProperties even after disconnecting from Photon. I tried to reset properties by calling
PhotonNetwork.player.SetCustomProperties(null)and
PhotonNetwork.player.SetCustomProperties(new Hashtable()), but it doesn't work, custom properties are still contain old Hashtable with data.
To be more specific, here's the complete test code piece:
PhotonNetwork.player.SetCustomProperties(null); Hashtable ht = PhotonNetwork.player.customProperties; if (ht != null) Debug.Log(ht.Count);
Log shows me 2 in the console. How can I nullify custom properties?
0
Comments
-
Hi,
The only way to clear player's properties is to set each existing property to null in SetCustomProperties hashtable parameter.0 -
Good point.
At the moment, you can't wipe your custom properties but it's a easy fix.
In PUN, you still have a local player, even when you're not in a room: PhotonNetwork.player. As you know what you do, you can simply modify the C# code for PhotonPlayer.customProperties. Make the setter public and use it to replace the Hashtable when needed. Alternatively add a method PhotonPlayer.WipeProps() and set the Hashtable then.0