The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Reset player custom properties

madfatcat
2015-01-31 00:33:55

Hi,

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:

Log shows me 2 in the console. How can I nullify custom properties?

Comments

vadim
2015-02-02 09:13:41

Hi,

The only way to clear player's properties is to set each existing property to null in SetCustomProperties hashtable parameter.

Tobias
2015-02-10 10:15:01

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.

Back to top