Join event actor properties?

Options
oneiro
oneiro
edited February 2011 in DotNet
I am using Unity. I modified the LiteGame example in Peer:

public void Join()
{
lock (this)
{
this.peer.OpJoin(this.gameID, null, new Hashtable { { (byte)100, "Oneiro" } }, true);
}
}

How do I retrieve the "Oneiro" value from the Join event? In EventAction, I tried:

Hashtable properties = (Hashtable)photonEvent[(byte)LiteEventKey.Properties];

but 'properties' var is null. At this line, I get: NullReferenceException: Object reference not set to an instance of an object

What am I doing wrong?

Comments

  • Tobias
    Options
    It's a client library lapse: The key used is not LiteEventKey.Properties but should be LiteEventKey.ActorProperties (or LiteEventKey.GameProperties). These two values of LiteEventKey are missing in the client side lib (including the current v6.1.0).

    As workaround use LiteOpKey enum and ActorProperties (or GameProperties as needed). The values are (byte) 14 and 15 respectively.

    I didn't even notice when creating the Chat demo (where I also used properties). Thanks for pointing me to it.
  • oneiro
    Options
    ok.. i changed it to: Hashtable properties = (Hashtable)photonEvent[(byte)LiteOpKey.ActorProperties];


    and got Key/Value: EventAction() 90

    the properties.Count is 1 so this is the only data in the hashtable. So you're saying there is no way to store data in the Join event, because the lib is incomplete?
  • Tobias
    Options
    No, I wanted to say that the values are set OK but in the event you're looking at the wrong value.
    In event action for event join, you need to check:

    propertiesOfJoiningActor = (Hashtable)joinEvent[(byte)LiteOpKey.ActorProperties];

    In that you should find the actorProperties you set.
    You can compare your code to Chat Demo: http://developer.exitgames.com/photoncl ... bychatdemo
  • oneiro
    Options
    got it working.. thanks!
  • Tobias
    Options
    Good to know. Thanks.
    I added the missing values to the client already, so they will be in the next client SDK release as well.