0

Short question: how can I get the list of existing rooms while staying in a room?

Long explanation:

I am developing a game for a client and I have a problem.

In short in the game I can see all the existing rooms from the menu and I can enter one of them (to view the existing rooms I join a lobby and use OnRoomListUpdate ()). Entering the room I would like to see the existing rooms again to change room, but I cannot enter a room and stay in the lobby at the same time, and therefore I cannot get the list of available rooms with OnRoomListUpdate ().

I have been working with Unity and PUN for years, but I can't find an elegant solution to this problem.

I use PUN 2 and Unity 2021 LTS.

Thanks for the support!

iFralex
  • 591
  • 1
  • 2
  • 9

1 Answers1

0

Once joining a room within PUN, you get moved from the Master Server (which has the list of all rooms), to a Game Server. There isn't a way to receive room list updates while inside a room because the Game Server simply doesn't have a list of rooms.

If you try doing a custom room query, like PhotonNetwork.GetCustomRoomList(TypedLobby.Default, "1=1");, it will throw an exception saying it's not allowed on the current server.

Theoretically, it's possible to keep an external list of rooms using Photon Server Webhooks with PathCreate, PathClose, and PathGameProperties, though it might be more trouble than it's worth. (plus, you need your own external server)

ipodtouch0218
  • 674
  • 1
  • 2
  • 13