Search Unity

PhotonNetwork Custom Properties

Discussion in 'Connected Games' started by DarHor, Mar 9, 2017.

  1. DarHor

    DarHor

    Joined:
    Apr 14, 2014
    Posts:
    4
    Hello. How to set custom properties to player? I try this way because didn't work:


    Code (CSharp):
    1. ExitGames.Client.Photon.Hashtable hash = new ExitGames.Client.Photon.Hashtable (){{"ID",1}};
    2.         PhotonNetwork.player.SetCustomProperties (hash,false);
    And i get error:
    And how to read this custom property or update?
     
  2. Kamil-Says

    Kamil-Says

    Joined:
    Jun 30, 2014
    Posts:
    154
    Why people never read the error messages? It says that your method has only one argument. Remove the bool argument and set only the hashtable to the method.

    That's how you read it, cast it with the value you set before int,string,byte etc
    Code (CSharp):
    1. string value =(string)PhotonNetwork.player.customProperties["key"];
    Updating the value works same: read the value, adjust value, create new hashtable, set the new value and update it on the player.
     
    MintArcade and tobiass like this.
unityunity