How to Get the list of current Rooms in photon 2 ?

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 Get the list of current Rooms in photon 2 ?

SaadAli2019
2019-03-15 19:11:50

In photon 2 PhotonNetwork.GetRoomList() is not available instead GeCustomRoomList() is Available so how to we use it?

Comments

sweetmei25
2019-03-17 18:25:52

Hi may i ask? where did you use the function?

sweetmei25
2019-03-17 18:27:08

inside OnReceivedRoomListUpdate ?

SaadAli2019
2019-03-17 20:30:44

Yes bcoz onReceivedRoomList is getting called Everytime someone enters or exit from room with no information weather it is called in response to someone entered or leaved the room bcoz I am displaying rooms in a UI so it is important to know if someone leaved or entered to update the UI.

JohnTube
2019-03-18 12:54:08

Hi @SaadAli2019,

Thank you for choosing Photon!

GetRoomList() != GeCustomRoomList()
GeCustomRoomList() is available in PUN1.
Read about GeCustomRoomList.

To replace GetRoomList in PUN2, you can find help from various discussions on the forum:

https://forum.photonengine.com/discussion/13546/get-the-list-of-available-rooms
https://forum.photonengine.com/discussion/13424/how-to-get-available-room-list-in-pun2-v2
https://forum.photonengine.com/discussion/12999/photonnetwork-getroomlist-disappeared-pun-2
https://forum.photonengine.com/discussion/12725/getting-room-list-in-pun-2
https://forum.photonengine.com/discussion/12668/photonnetwork-getroomlist-gone-in-pun2-how-can-i-modify-this-to-work-again

SaadAli2019
2019-03-18 13:13:02

onReceivedRoomList is getting called Everytime someone enters or exit from room with no information weather it is called in response to someone entered or leaved the room ?

JohnTube
2019-03-18 13:16:11

Hi @SaadAli2019,

I can't find a method named onReceivedRoomList in PUN2.
PUN2 callback ILobbyCallbacks.OnRoomListUpdate is triggered only when joined to a lobby.

SaadAli2019
2019-03-18 13:32:51

sorry it was typo .. you are right the method is OnRoomListUpdate(List roomList) this method gets called every time someone join or leave the room with no information wheather the received romlist contains the list of removed rooms or new room created...

lets say i have 5 rooms and i am displaying them in a UI by name and then ILobbyCallbacks.OnRoomListUpdate() gets called becoz someone either created or removed the room so how do i update the room list UI bcoz i dont know if the roomlist i received is newly created room or removed room

JohnTube
2019-03-18 14:46:31

Searching the forum will help you.
For example, this discussion has an implementation.
PUN2's CockPit demo has this implemented.

Back to top