Quantcast
Channel: Photon Unity Networking (PUN) — Photon Engine
Viewing all articles
Browse latest Browse all 8947

Can't reference the hashtable

$
0
0
Need some help referencing a Hashtable I created in the awake function:

So in the Awake function I am trying to set up the custom properties:


public void Awake(){
ExitGames.Client.Photon.Hashtable props = new ExitGames.Client.Photon.Hashtable();
props.Add("score", 0);
PhotonNetwork.player.SetCustomProperties(props);
}



Later, in a function where the player has gotten a point added to his score, I have:

[code]
public void getPoint(){
score = (int)PhotonNetwork.player.CustomProperties["score"];
score++;
PhotonNetwork.player.CustomProperties ["score"] = score;
PhotonNetwork.player.SetCustomProperties(props);
}
[/code]

I get the following error: The name `props' does not exist in the current context

Anyone know how I can reference the props Hashtable?



Viewing all articles
Browse latest Browse all 8947

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>