How to check if the custom room I want to join already has the max number of player in it ?

I am in middle of a multiplayer game with Photon on Unity and I am stuck when I need to allow player to enter the custom room but check the number of players in it beforehand

Comments

  • Hi @swatantra,

    Thank you for choosing Photon!

    If you join a lobby and show a list of available rooms to the user you can get the player count from the lobby. Even so, sometimes multiple players try to join at the same time so the join may fail for one of the players because the spot was already taken and the room became full.

    So what we recommend is the optimistic approach: join the room and if the server tells you it's full handle the error by showing some feedback to the user or join another room or create another room etc.
Sign In or Register to comment.