How to stop player from joining any room in running game

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

How to stop player from joining any room in running game

pawan_arora
2014-05-27 09:18:34

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

vadim
2014-05-27 09:51:25

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;

pawan_arora
2014-05-27 12:44:52

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?

vadim
2014-05-28 07:36:04

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.

Back to top