Search Unity

Third Party Photon: Can't see existing rooms in the lobby

Discussion in 'Multiplayer' started by vatsadevil, Feb 21, 2022.

  1. vatsadevil

    vatsadevil

    Joined:
    Jan 26, 2018
    Posts:
    2
    Hi,

    I'm using PUN2. Not sure if this is by design, or if I got something wrong. When two clients are connected to master server, and one of them creates a room, the other client get a callback through OnRoomListUpdate(List<RoomInfo> roomList).

    However, when one of the client connects to master AFTER the room was created, OnRoomListUpdate does get called, but the list is empty. But interestingly enough, If I manually try to connect using the room name, I'm able to connect successfully.

    Ideally, I'd like to see all the open rooms in the lobby in OnRoomListUpdate callback irrespective of when I connect to server. Any thoughts?
     
  2. vatsadevil

    vatsadevil

    Joined:
    Jan 26, 2018
    Posts:
    2
    Update: Tried running a test on an empty project with single scene. Everything seems to work fine. So i'm guessing the issue is I'm switching between two different scenes(?) I don't see why that would be an issue since lobbies and rooms aren't really tied to a unity scene in anyway.
     
  3. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,066
    I can't reproduce this issue with the Asteroids Demo in the PUN 2 package.
    Does that expose the same problem, as your project?

    Switching scenes does not make a difference to the matchmaking (see Matchmaking Checklist).
    Make sure all clients get into the same region, use the same appid / game version and also all join the lobby.
     
  4. reendevelops

    reendevelops

    Joined:
    May 6, 2021
    Posts:
    15
    I would like to update this post.

    I'm also currently struggling with this problem. Like the OP said, if both players are already in a lobby and one player creates a room, it works fine. But if a player creates a room while the other is not yet in a lobby, when that player finally joins a lobby, the OnRoomListUpdate() callback comes empty.

    Has anyone found a solution?

    Or perhaps an alternative? Maybe the way we're doing Room displays is wrong.
     
  5. reendevelops

    reendevelops

    Joined:
    May 6, 2021
    Posts:
    15
    AAAAAAAAAAAHHHHHHHHHHHHHHH *scream of agony*

    After days of grueling trials and error, I finally figured it out.

    The cause of my problem was actually not my fault. I followed a YouTube tutorial on setting up PUN 2 scenes, and that video (
    ) joined the Lobby during a LoadingScene. So when the OnRoomListUpdate() callback gets invoked, it would be in the LoadingScene. And obviously due to the name, I wouldn't make my Lobby listing in the LoadingScene.

    And now, I removed the PhotonNetwork.JoinLobby() from the LoadingScene, but only called PhotonNetwork.ConnectUsingSettings() while loading the LobbyScene. And when the LobbyScene is loaded, that's when I join the Photon Lobby.

    I hope this made sense.. as I am still upset with this simple misconception that lost me hours of working time.
     
  6. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,066
    Happy to read you found a solution. Thanks for the update.