PhotonNetwork.GetRoomList() returning zero.

Options
Hi,
Master client creates room using
PhotonNetwork.CreateRoom(name,
             new RoomOptions() { isVisible = true, isOpen = true, maxPlayers = (byte)maxPlayersCount }, TypedLobby.Default)
. But from the client side even after doing the initial setup of photon I log the rooms count here
public override void OnReceivedRoomListUpdate()
    {
        Debug.Log("OnReceivedRoomListUpdate called");

        if (m_notifier != null)
        {
            m_notifier.OnSessionListRefreshed();
            RoomInfo[] roomsList = PhotonNetwork.GetRoomList();
            Debug.Log(" OnReceivedRoomListUpdate Room list count" + roomsList.Length);
        }
    }
But still the length is zero and i have Auto Join lobby true in settings.

Pleas help!

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @ssakthi,

    Master client creates room
    A client is not called a "master client" only inside a room.
    public override void OnReceivedRoomListUpdate()
        {
            Debug.Log("OnReceivedRoomListUpdate called");
    I see you are overriding the method. What calls are you extending?
    Is this callback triggered? Do you see "OnReceivedRoomListUpdate called" log entries in the Unity Editor console?
    Make sure you are inside the lobby first by implementing "OnJoinLobby" callback.
  • ssakthi
    Options
    Yes OnJoinLobby is called first after that only am calling the Roomlist api. The problem which I dint mention before is that the same code is working fine with android and desktop .But if I create room in Windows immersive devices both android and desktop says room list as 0 and vice versa.

  • ssakthi
    Options
    And yes am using the latest MRTK .
  • marswong
    Options
    I attempted to ask a similar question but for some reason this forum won't allow me to post questions (?!)

    While previously working, PhotonNetwork.GetRoomList() now returns an empty RoomInfo[]
    However, PhotonNetwork.countOfRooms returns the correct number of rooms
    I've tried waiting for the OnReceivedRoomListUpdate() callback function as well as saving GetRoomList() to an array/list
    I am currently in a unique LobbyType.Default initialized as such:

    TypedLobby MyLobby = new TypedLobby(PhotonNetwork.player.UserId, LobbyType.Default);
    PhotonNetwork.JoinLobby(MyLobby);

    mw

    At this point I could probably find more support on the p2p offered through STEAMWORKS.NET smh
  • Hi @marswong,

    can you confirm, that the rooms got created in the same lobby? It isn't enough to just let the client join the lobby, instead when a room gets created you have to set this lobby as parameter, for example PhotonNetwork.JoinOrCreateRoom("Room", options, MyLobby);.
  • marswong
    Options
    @Christian_Simon , just tried that to no avail:
    
    private TypedLobby Lobby;
    
    void OnConnectedToMaster()
        {
             Lobby = new TypedLobby("Generic Lobby", LobbyType.Default);
             PhotonNetwork.JoinLobby(Lobby);
        }
    void CreateRoom()
        {
            RoomOptions Options = new RoomOptions { IsVisible = true, IsOpen = true, MaxPlayers = 8 };
            PhotonNetwork.JoinOrCreateRoom((PhotonNetwork.countOfRooms + 1).ToString(), Options, Lobby);
        }
  • marswong
    Options
    Bump
  • marswong
    Options
    I found my answer here:
    void OnReceivedRoomListUpdate() 
    {
        var roomsList = PhotonNetwork.GetRoomList();
    } 
    However, I recommend initializing roomsList as a List<RoomInfo> out of the callback, thereby allowing you to crossreference your representation of the rooms, the UI presumably housed in another list, by using a function similar to mine:
    RoomInfo GetRoom (string RoomName)
        {
            foreach (RoomInfo Room in Rooms)
            {
                if (Room.Name == RoomName)
                {
                    return Room;
                }
            }
            return null;
        }