GetRoomList not working?

Options
I already posted this but i think i put it in the wrong section of the forum. So i'll post it here :)
sorry about that.

Hi, i've had no problem using the PhotonNetwork.GetRoomList() before, but now it doesn't seem to work. No matter what i do.
I can see the amount of players currently using the app and the number of rooms.
By using PhotonNetwork.countOf blah blah.

foreach(RoomInfo info in PhotonNetwork.GetRoomList()) doesn't do anything
even with a simple Debug.Log(info.name);
Despite my room options being set to open and visible both = true.

I've even built the game 5 times and ran them all at the same time with different rooms and some in the same room. it just will not display.

sorry i hate not being able to figure stuff out for myself, but, I'm stuck as ****

if it helps i did update to the latest version of PUN today.

Thank you and sorry to rattle on.

Comments

  • Rigs
    Options
    Thank you for your reply and although it helped a little, it didn't really answer my question.
    And as for the room listing, it says and i quote "We prefer games to use Random Matchmaking over listing rooms. The process to get into a room is much leaner when you don't use the lobby to show rooms." surely its not down to you to tell people how they should have the games set up?(sorry if that sounded rude, it's not meant too. just didn't know how else to word it)
    some people like to able to have list and what not.
    so GetRoomList() no longer works?

    Thanks again
  • Tobias
    Options
    I didn't mean to tell anyone how to design the game or UI. That quoted piece was about the benefits of not listing the rooms. Aside from personal preference, there are also reasonable situations where you would prefer the list.
    No offense meant and none taken :)

    Yes, GetRoomList() works but only under certain conditions. You now have to turn this on in the PhotonServerSettings and your clients get the lists when they are in a (Photon) Lobby, not in a room.

    Did you make it work with the setting by now?
  • Sorry but just updated my PUN and now GetRoomList() no longer works. Tobias, I tried looking in the PhotonServerSettings to enable this feature but couldn't find it, could you point me in the right location please.

    -Raymond
  • Set "Auto-Join Lobby" checkbox in PhotonServerSettings inspector
  • Rigs
    Options
    i apologise again and stand corrected. thank you everyone
  • Tobias
    Options
    Sorry for the hassle. I'm happy to read you could make it run!
    Have a nice weekend.
  • pkauffold
    Options
    I'm sorry to open this one up again, but I'm having the same problem, even with "AutoJoinLobby" checked in PhotonServerSettings.

    This is an abbreviated version of my script, which is kind of a mess right now, but I can post the whole thing too). The "listOfRooms() function is my own that's meant to generate labels for button. The "room name" comes from the player name.

    The length of the "roomNamesInfo" array always comes up as 0, so it isn't getting populated.

    I've also tried the

    foreach (RoomInfo game in PhotonNetwork.GetRoomList())

    just to try a different approach, but every time comes up empty.

    Any help would be super appreciated. I am very impressed with PUN so far, but this is driving me crazy.


    private RoomInfo[] roomNamesInfo;
    private RoomOptions roomOptions ;
    TypedLobby sqlLobby = new TypedLobby ("myLobby", LobbyType.SqlLobby);

    void Start ()
    {

    roomOptions = new RoomOptions ();
    roomOptions.isOpen = true;
    roomOptions.isVisible = true;
    roomOptions.maxPlayers = 8;


    }


    void OnReceivedRoomListUpdate ()
    {

    //two different ways of trying to get the room list

    foreach (RoomInfo game in PhotonNetwork.GetRoomList()) {
    print ("game name is " + game.name);
    }


    roomNamesInfo = PhotonNetwork.GetRoomList ();
    print ("info length is " + roomNamesInfo.Length);

    if (roomNamesInfo.Length > 0) {

    listOfRooms ();
    }

    }


    public void createRoom ()
    {

    PhotonNetwork.CreateRoom (roomName, roomOptions, sqlLobby);
    }


    }
  • pkauffold
    Options
    Oh, I'm testing it by opening up a build, going from the lobby and creating a room. Then through unity, running it again. I feel like I should see one room that the actual standalone build created
  • Tobias
    Options
    Did you turn on "Auto Join Lobby" in PhotonServerSettings?
    http://forum.photonengine.com/discussion/6426/autojoinlobby-disabled-in-pun-v1-60#latest
  • pkauffold
    pkauffold
    edited August 2015
    Options
    Hi Tobias, and thanks. I do have that box checked.
  • Tobias
    Tobias admin
    edited August 2015
    Options
    Change the lobby type to LobbyType.Default. The SQL Lobby doesn't list the rooms. It just gives you more control about (server-side) random matchmaking.
    And make sure you join that lobby, to get it's list. If you join the default lobby (no name, type = default), you won't get rooms listed that are in your own.
  • pkauffold
    Options
    So I changed the lobby type default with this line.

    TypedLobby defaultLobby = new TypedLobby ("philsLobby", LobbyType.Default);

    I have some debugging code in there as well telling me the name of the lobby and it does come up properly, but I still don't seem to be able to get a list of the room names. Again, I have stand alone build I run first, create a room with a specific name (I have a text field you can type in a player name).

    I'm going to maybe go back to the beginning and start over, but is there a code example for this I can look at, similar to the Marco Polo example? That was super-useful in getting started and understanding how this works, but I wonder if I'm just missing something simple.

    Thanks once again for the help!
  • Tobias
    Options
    Sorry, I there is no more related material than Marco Polo and this:
    https://doc.photonengine.com/en/pun/current/tutorials/matchmaking-and-lobby

    If you want to list rooms in your own lobby, then you only have to join it. JoinLobby(myLobby). If you create games, those should be tied to that lobby automatically, while you're in said lobby.
    You can create games in any lobby you like, no matter in which one the client is currently. Maybe you explicitly use your lobby when you CreateRoom()...?

    I don't know where you're stuck. It must be something simple which you missed.
    Maybe you use a new, empty project and modify some of the demos to experiment with it?