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.

Getting room list in PUN 2

BuilderWorldVR
2018-10-15 22:20:07

Hi, I'm new to PUN, and decided to use V2. How can I get a list of all the active rooms that users are in?
The documentation suggests using PhotonNetwork.GetRoomList(), but this method does not exist in PUN 2. It seems to have been dropped with no replacement. ???

Comments

[Deleted User]
2018-10-16 09:39:28

Hi @BuilderWorldVR,

where did you find this information in the documentation? Right now, not all of the documentation has been updated, we are still working on it.

In PUN 2 you would have to deal with the Room List in another way, since it isn't cached internally any longer. To start with it, I would recommend you taking a look at the Asteroids demo, which is included in the PUN 2 package. Having this imported, you can take a look at the LobbyMainPanel class. This one implements the necessary callback named void OnRoomListUpdate(List roomList). It gets called whenever the client receives an updated room list from the server. This happens automatically. Inside this callback, void UpdateCachedRoomList(List roomList) gets called, which updates the cached room list accordingly. Afterwards you can access the cached room list to see which rooms are available. In the demo we are doing this in the void UpdateRoomListView() function.

BuilderWorldVR
2018-10-20 04:19:29

HI, thanks for this, and the other response. Will check the Asteroids demo. Regarding the documentation, I sent this to Tobias via email, and he said it would be corrected. thanks.

bartlomiejwolk
2019-03-13 10:10:40

I would like to add sth. that wasn't immediately obvious to me. OnRoomListUpdate() callback is called immediately after joining a lobby on the server (by calling PhotonNetwork.JoinLobby())

Maestro_Cinetik
2021-09-23 15:47:03

bartlomiejwolk 2019-03-13T10:10:40+00:00
I would like to add sth. that wasn't immediately obvious to me. OnRoomListUpdate() callback is called immediately after joining a lobby on the server (by calling PhotonNetwork.JoinLobby()) THANK YOU! I lost dumbly 1 day on that one

Back to top