GetRoomList() does not show any room when it called immediately after joining a lobby

Options
Hello,

I want the room list to be shown when a player joins a lobby, thus I use GetRoomList() in OnJoinedLobby(), like this:
public override void OnJoinedLobby()
{
        foreach (RoomInfo room in PhotonNetwork.GetRoomList())
        {
            Debug.Log("room name:" + room.Name + " " + room.PlayerCount);
        }
}
The console does not show anything.

However, if I call GetRoomList() in Awake(), the console will log the rooms existing in the lobby. And it would also work when I make a button and assign its Onclick to GetRoomList().

But I don't want GetRoomList() to be called in every frame, nor do I want to ask the players to press a button to show the room list. Anybody know why it does not work in OnJoinedLobby()?

Best Answers

Answers

  • AloneWolf
    Options
    auto join lobby enabled ?
  • Philip_hu
    Options
    Yes, it is enabled.