CurrentRoom.Players.Count is not been updated after a second player joins a room?

Options
I create a random room from a Master player, when another player (client) joins that room I receive the event 255 (join game) on master player but CurrentRoom.Players.Count is not been updated so I am not able to call SavePlayersInProps() function, I am using the Memory card example. My RoomProps are configure same as example with Maxplayer=2.
So when I try to play the Master user turn GameCanStart returns false.

But on the client side(second player) I am able to see that CurrentRoom.Players.Count is been updated to 2 after Event Join. Any Idea why this is happening? I am using current SDK v4.0.5.1 on Unity 5.2 and I am using Webhooks v1.2 demo configuration.

Answers

  • vadim
    Options
    Where do you check CurrentRoom.Players.Count? What is in CurrentRoom.Players list? What is LoadBalancingClient.State?
    Do you mean that Memory card example does not work for you? Or you use it as template for you own app?
  • jmorales
    Options
    I check CurrentRoom.Players.Count right after case EventCode.Join on operation OnEvent(), I just looked at property LoadBalancingClient.State = 'Joined', CurrentRoom.Players list only has only one element after second player joined the room...

    I am using Memory card example as a template, and this example works perfectly!

    But as I said before this is happening on the master user side because on the second player side the CurrentRoom.Players is being updated to 2
  • vadim
    Options
    So you override LoadBalancingClient.OnEvent()? Do you call base.OnEven() at the beginning of the method?
  • jmorales
    Options
    Yes, I override LoadBalancingClient.OnEvent method and I am calling base.OnEvent(photonEvent) at the beginning of the method.
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited February 2016
    Options
    Just to make sure RoomOptions.SuppressRoomEvents = false.
  • jmorales
    Options
    ok I just set RoomOptions.SuppressRoomEvents to false before I call OpCreateRoom() operation, but still the same, any Idea what else could be?
  • vadim
    Options
    I added logging of CurrentRoom.Players.Count right after case EventCode.Join: in OnEvent method of MemoryGameClient.cs script. Everything works as expected. It prints "1" on room creation and "2" on other player connection.
  • jmorales
    Options
    ok thanks Vadim I will try to change my implementation to see if there is something wrong with my current solution