Quantcast
Channel: Recent Discussions — Photon Engine
Viewing all articles
Browse latest Browse all 15755

Using player.CustomProperties to store Colors and Materials

$
0
0
Hello everyone!

Setting up a sample project to test a few of the networking packages that are available and so far I've had success getting Photon set up. I'm building a lobby and have reached the part where I need to start sending and updating data between the players. The first thing I've tried to do is set up a custom property for which color the player has selected, and placed the R, G, B, A values into a Hashtable.

public void SetColor() {
localUserColor = new Color ();
localUserColor.r = 0;
localUserColor.g = 0;
localUserColor.b = 0;
localUserColor.a = 1;

Hashtable colorHash = new Hashtable();
colorHash.Add("R", localUserColor.r);
colorHash.Add("G", localUserColor.g);
colorHash.Add("B", localUserColor.b);
colorHash.Add("A", localUserColor.a);
PhotonNetwork.player.SetCustomProperties(colorHash);
}

I had planned to update the player color for all players under a foreach loop:

public void OnPhotonPlayerPropertiesChanged () {
foreach (PhotonPlayer player in PhotonNetwork.playerList) {

}
}

Problem is I'm having issues solving how to access the values of the hash table to plug them back into the image's Color. I combed the documentation but it doesn't seem to work the way I think it does.

Totally new to Networked games, any advice is wonderful.

Thank you,

Viewing all articles
Browse latest Browse all 15755

Trending Articles