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

PhotonPlayer.SetCustomProperties (or get?) weird behavior

$
0
0
Hello,
Trying to make a card game, the masterclient shuffles a deck and then setting each player's deck by setting the custom properties.

This is the general flow\code:
using Hashtable = ExitGames.Client.Photon.Hashtable;

public classGameManager : PunBehaviour
{
    private PhotonPlayer local;
    Hashtable player0pht;

    public override void OnJoinedRoom()
    {
            local = PhotonNetwork.player;
            if (PhotonNetwork.isMasterClient)
            {
                     player0pht = new Hashtable();
                     for (int i = 0; i < entireDeck.Count; i++) // entireDeck = list of cards
                     {
                                 // local player will only get any second card of the deck
                                  if (i % 2 == 0)
                                 { player0pht.Add(i / 2, entireDeck[i]); 
                     }
                     local.SetCustomProperties(player0pht);
                     player0pht.PrintHashtable(); // Print A (extension method to print the hashtable)
                     print("local properties count: " + local.CustomProperties.Count);
                     local.CustomProperties.PrintHashtable(); // Print B
            }
    }
}
Print A is fine.
Print B is empty (no hashtable). (and the line before is "local properties count: 0")
what's wrong in this picture?

Viewing all articles
Browse latest Browse all 15755

Trending Articles