How to join a different room while currently inside a room?

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 join a different room while currently inside a room?

Klover
2021-12-24 01:15:23

So the problem I'm facing here is that players join a room so they can party up together, like joining the same waiting room as your friends. But I want all of the players in the waiting room to join the same game together!

I know I'm probably going to have to make the Host send an RPC function so everyone joins, but I just don't know exactly how this is all going to work...

Comments

JohnTube
2021-12-24 02:20:22

Hi @Klover

Thank you for choosing Photon!

In order to switch rooms you need to leave the currently joined one and join another.

To achieve the matchmaking you want you could make use of FindFriends where you poll for the master client's UserId and follow him to the next room if you don't know the room name, if the room name is known simply go to that room as explained above: leave and then join.

Back to top