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! Your search result can be found below. Plus, we offer support via 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.

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

micahlg
2016-05-19 01:24:09

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
}
}

vadim
2016-05-20 16:03:07

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.

micahlg
2016-05-20 18:34:37

So something like going through a loop of the players in the room and disconnecting them when the master client leaves?

Back to top