How to get the list of all rooms
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).
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
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).
Somewhere at the top of each doc page, you can switch between Classic and V2 PUN.
Back to top