Room Properties, byte arry not the expect result

Options
Hello, im trying to use Room properties to make kind of a ready check list.
Im sorting the Photon Player List after the ids so it is always the same .
Then I create a byte[] with the length of playerlist ,now I check witch position the player is in the sorted photon player list , lets say 2 then I just do byte[2] = 1 . 1means readt 0 not ready. When I read the properties I just count the 1in the arry and I know how many players are rdy.

https://pastebin.com/jx76u8RK
Thats the Method I got problems with.
Did I made a logic failure somewhere or did just something stupid ?

When I try to read the byte list it always returns 1 for one player is ready..sure checked with multiple clients.
Also im using OnCustomRoomPropertiesChanged to catch the changes, wich works fine.

Thx for Helping.

Best Answer

  • [Deleted User]
    Answer ✓
    Options
    Hi @S_Oliver,

    you can also use the Custom Player Properties and let each client set a certain property when he has finished loading the scene. When a property gets set, void OnPhotonPlayerPropertiesChanged(object[] playerAndUpdatedProps) gets called on all clients. The MasterClient can use this callback, to iterate through all clients' properties and check, if all of them are ready. If so he can start the game and notify the other clients.

Answers

  • S_Oliver
    S_Oliver ✭✭✭
    edited July 2018
    Options
    Atm i got a small scene to load.
    I use this, to know when the scene loading is done and use the SetClientReady Method.
    I think it will always make problems like this because Clients access, in my test scenarios the Properties, at the same time.

    I shifted the work to the MasterClient.
  • [Deleted User]
    Answer ✓
    Options
    Hi @S_Oliver,

    you can also use the Custom Player Properties and let each client set a certain property when he has finished loading the scene. When a property gets set, void OnPhotonPlayerPropertiesChanged(object[] playerAndUpdatedProps) gets called on all clients. The MasterClient can use this callback, to iterate through all clients' properties and check, if all of them are ready. If so he can start the game and notify the other clients.
  • S_Oliver
    S_Oliver ✭✭✭
    Options
    Yeah it does, for a while I did it this way, I dont remember why but I didn't liked it .
    Nvm, thanks for support/answer.