PhotonNetwork.player.SetCustomProperties()

Options
Hi, sorry for all the questions on this forum, but im learning heh. i didnt even know hashtables existed till i saw setcustomproperties.

ok so i am trying to save a local variable 'score' into setcustomproperties so that the masterclient can use the value to update a menu score. i have set it as so:

[code2=csharp]public int score = 0;
public Hashtable hash;

void OnJoinedRoom(){
hash = new Hashtable();
hash.Add("score", score);
PhotonNetwork.player.SetCustomProperties(hash);[/code2]

what i dont know how to do is to get that score so the masterclient can use it. so just to save lines, lets say i wanted a big line of player names and scores in debug.log. how do i do that? im guessing something like this:

[code2=csharp]foreach(PhotonPlayer name in PhotonNetwork.playerList){
Debug.Log(name.name + " " + name.customProperties.??);
}[/code2]

thanks for the help sofar again too heh. its helping alot. :D

Comments

  • Tobias
    Options
    The custom property you set is named (by you) "score". You can access this by anyPlayerFromList.customProperties["score"].