Keeping track of all the custom properties.
Options
Hi!
During the development I am assigning plenty of custom properties for players as well as for rooms that sometimes I forget their names and where are they exactly in code. Is there some easy way to peek all my custom properties or do I have to just keep them organised by myself?
During the development I am assigning plenty of custom properties for players as well as for rooms that sometimes I forget their names and where are they exactly in code. Is there some easy way to peek all my custom properties or do I have to just keep them organised by myself?
0
Comments
-
Hi @fastbyte22,
Thank you for choosing Photon!
All custom properties are available via Room.CustomProperties or Player.CustomProperties once they are set.0 -
Best practice is to keep them organised yourself. What i usually do wrapp the whole propertie stuff up.
https://github.com/SradnickDev/Photon-Misc/blob/master/Assets/Utilities/PropertyHelper.cs see here
and finally i do something like this
https://github.com/SradnickDev/Photon-Misc/blob/master/Assets/Utilities/PropertyKeys.cs
For Player
https://github.com/SradnickDev/Photon-Misc/blob/master/Assets/Utilities/PlayerExt.cs
For Rooms
https://github.com/SradnickDev/Photon-Misc/blob/master/Assets/Utilities/RoomExt.cs
This way you can easily organise, extend and access Properties like
ExamplePhotonNetwork.LocalPlayer.GetTeam(); PhotonNetwork.LocalPlayer.IsReady() ; PhotonNetwork.CurrentRoom.SetMatchTime();
stuff like this^^
Edit:
For i while I also tried to use player properties within the inspector.
So you can connect methods trough the inspector and wait for propertie updated callback to trigger the method.
But never used that^^
https://gist.github.com/SradnickDev/2895caad7e50b61297a7a0a365df536a
1