Closing a room
The whole answer can be found below.
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).
Closing a room
micahlg
2016-05-19 01:22:51
Hi, in my game currently when the master client leaves, the room that was created by him is still there. I have tried passing over the master client to another player, but so far have no been satisfied with the results.
I am wondering how you would close a room? Something like:
<code class="
void OnPhotonPlayerDisconnected(PhotonPlayer player)
{
if(player.isMasterClient)
{
PhotonNetwork.CloseRoom();
}
}
">
Is there anything like this?
Comments
Ugh, I'm sorry. It won't let me edit my post. Here's the code I am asking if there's something like it:
void OnPhotonPlayerDisconnected(PhotonPlayer player)
{
if(player.isMasterClient)
{
PhotonNetwork.CloseRoom(); //closes current room
}
}
Room is closed after all players leave the room.
Broadcast RPC from master going to leave to all clients asking them to leave also.
Or handle master change event on every client and leave.
So something like going through a loop of the players in the room and disconnecting them when the master client leaves?
Back to top