Photon Custom Properties
- Custom properties are actually the best way to synchronizes information and states within all the player instances.
- Custom properties are automatically synchronized between player (at least < 0.5s (could be faster))
- Custom properties exist on each player and on the “room”. So the room and each player can contain those variables.
- Be careful to use very unique key name on player and room to be sure you don’t interfere with Somnium SDK.
Stream Recording (2022-05-08)
Premade Projects
Unity Package Option 1: “Simple Custom Properties”
I made tow nodes to Set and Get a custom property. Be careful, you can’t set or get “custom properties” to fast. Try to avoid getting or setting properties faster than twice a second.
Unity Package Option 2: “Advanced Custom Properties”
- This is an other little project I made for you (A gift from my IncrediWorlds project), with this project, you can set and get custom properties without worrying about overloading the network.
- A global script will do the synchronization while the “Set” and “Get” nodes only affect local variables.
- (Warning) Please do not install with the other project, the 2 packages will interfere. The tow project are not complementary.
- This system is made of 3 script:
- A “controller” (a script that need to exist once in the world)
- A GetCustomProjetries script
- A SetCustomProjetries script
- The test scene will be located at “Assets/#Local/#Packages/Denevraut Modules”
Basic Tutorial
Setting custom properties
- To add or edit one or more custom properties, you need to create a dictionary/hash-table. (even if it already exist).
- In this example, we are setting the property “DoorOneState” with a boolean value. The value can have any type (string, bool, int, float etc).
Nodes to add in “Unit Options Wizard“
Unit Options Wizard: Assembly Options
Photon.3Unity3D
PhotonUnityNetworking
PhotonRealtime

Unit Options Wizard: Type Options
PhotonView
Hashtable * (from ExitGames.Client.Photon)
Room
PhotonNetwork

Setting a network variable script
Not just for the first time, updating the variable need the same script

Getting network variable
- Reading a property is a little more complex since you need to be sure it exist and it have the right type.
- In this example, we are reading we are first checking if the property “DoorOneState” exist from the list, then we check if the type is correct.
