Search Unity

Resolved Query Lobbies not getting lobbies

Discussion in 'Lobby' started by MiTschMR, Sep 23, 2022.

  1. MiTschMR

    MiTschMR

    Joined:
    Aug 28, 2018
    Posts:
    494
    Somehow I am not getting any lobbies when using this code:

    Code (CSharp):
    1. QueryResponse response = await LobbyService.Instance.QueryLobbiesAsync();
    I have created several lobbies in advance and can get them without issues, but even if they are public, they do not appear in the queried response. I initialize UGS first, then log in anonymously and finally query for the lobbies.

    I am grateful for anyone who might have a possible idea on what might be the issue.

    Edit: Is it not possible to get the lobbies you are a part of with the query?
     
  2. MiTschMR

    MiTschMR

    Joined:
    Aug 28, 2018
    Posts:
    494
    Please nevermind, the default value of a lobby to be considered inactive was 30 seconds...
     
  3. RobustKnittedTortoise

    RobustKnittedTortoise

    Unity Technologies

    Joined:
    Dec 10, 2018
    Posts:
    16
    Sorry that was giving you trouble, that value aligns with the heartbeat requirement and is great for making sure players are not quick joining or query + joining into a lobby that has been abandoned BUT not so great for testing like this. If you do want a list of the lobbies that you previously joined there is an API for that:
    Code (CSharp):
    1. LobbyApi.GetJoinedLobbiesAsync
    It returns the ids of any lobbies you are part of that still exist and includes inactive lobbies. One of its intended uses is to allow a client to recover after a crash by finding and reconnecting to the previously joined lobby.
     
  4. MiTschMR

    MiTschMR

    Joined:
    Aug 28, 2018
    Posts:
    494
    Yes, thanks, I was already using this API to remove all lobbies when I complete testing each day I work on my project.

    I will add documentation to use the heartbeat functionality whenever we create new lobbies to make sure they don’t disappear again like that ;)