Preventing joining a room during active game

Options
What's the best way to prevent players from joining a room when a game is in progress? After a game is done, we will want to open it back up for joining assuming there are open slots. I know I could create a custom room property, but is there a better way? If I set the max players to be the current # of players, will that prevent joining? Our game is already using IsVisible to distinguish between public and private games so I need to use another field. Naturally it would also be great to use a field that I can access without needing to actually join the room. Thanks in advance for any suggestions. Dan

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @dyawitz,

    Thank you for choosing Photon!

    What's the best way to prevent players from joining a room when a game is in progress?
    Close the room via Room.IsOpen = false;.
    If I set the max players to be the current # of players, will that prevent joining?
    Yes possible.

    Naturally it would also be great to use a field that I can access without needing to actually join the room.
    Rooms' properties cannot be changed from the outside. You can get some read-only properties from the rooms list in the lobby however like MaxPlayers, PlayersCount, IsOpen and custom properties visible to the lobby.