How to get array in unity from colyseus state?
Array handling in colyseus.
hi @ahtashamabbasse, not sure if this was already replied on Discord, I'll post here anyway!
you can listen to your hand
structure using something like this:
room.Listen("hands/:index/:attribute", this.OnHandChange);
// ...
void OnHandChange(DataChange change)
{
Debug.Log(change.path["index"]);
Debug.Log(change.path["attribute"]);
Debug.Log("has changed to");
Debug.Log(change.value);
}
The callback will be called for each attribute you have on each item in your array. Here's the logs I've got from this: