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.

How to get the list of all rooms

Garvit13
2021-01-27 08:06:31

I am fairly new to photon and was following tutorials from youtube (Rugbug Redfern)...
To get the list of Rooms, he used the OnRoomListUpdate callback. According to the docs - "Called for any update of the room-listing while in a lobby (InLobby) on the Master Server". So, if there is no update in the room list after the script has loaded then the callback won't be fired? So it won't list any rooms?
So, I googled "How to get the list of all rooms in Photon Unity" to find if there is another way and found this,
https://forum.photonengine.com/discussion/6040/how-to-get-a-list-of-rooms-available
The answer there uses a method "PhotonNetwork.GetRoomList()".
When I searched for the method it does exist in the docs (https://doc-api.photonengine.com/en/pun/v1/class_photon_network.html)
but Rider and Unity keep telling me that they cannot find the method.

The version at the top of the page is 1.101 and my plugin version is 2.27.
Maybe it is the documentation version?
If not how do I get the list in the new version without the problem mentioned above?

Any help is appreciated...

Comments

Tobias
2021-01-27 13:59:44

In PUN 2, there is no cache of the full list. You get the initial one and then updates.
For that, register for the callbacks (and you have to join a lobby).

https://doc.photonengine.com/en-us/pun/current/lobby-and-matchmaking/matchmaking-and-lobby#default_lobby_type

Somewhere at the top of each doc page, you can switch between Classic and V2 PUN.

Back to top