How to stop player from joining any room in running game

I've created a room, with max players up to 5. After waiting for some time to fill the players with room. I start the game, but if the players are less than 5, I don't want any new player to join later. I only want the player to join the room before the game is started or after game is finished. How can I ensure that?

Comments

  • You can 'close' current room for joining:
    PhotonNetwork.room.open = false;
    Optionally the room also can be set invisible in lobby list:
    PhotonNetwork.room.visible = false;
  • Thanks. I also want to know is it better to create new room for new game or reuse the already existing room which was used earlier?
  • Choose what is more appropriate for you. If no persistent data between games, then new room looks preferable.
    Moreover after last player left the room, it's destroyed automatically. In this case there is no way to start game in used room.
    But if players are still joined and want just 'reset' the game then you may reuse the room without any problems.