Getting room list in PUN 2

Options
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

  • 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<RoomInfo> roomList). It gets called whenever the client receives an updated room list from the server. This happens automatically. Inside this callback, void UpdateCachedRoomList(List<RoomInfo> 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.
  • 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.
  • 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())