Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question [Lobby]: NoOpenLobbies, (16006). Message: failed to find any open lobbies matching the search criter

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

Thread Status:
Not open for further replies.
  1. Max_power1965

    Max_power1965

    Joined:
    Oct 31, 2013
    Posts:
    127
    Hello I have the following code:
    Code (CSharp):
    1. private async void LookingForLobby()
    2.     {
    3.         try
    4.         {
    5.             QuickJoinLobbyOptions options = new QuickJoinLobbyOptions();
    6.            
    7.             // options.Filter = new List<QueryFilter>()
    8.             // {
    9.             //     new QueryFilter(
    10.             //         field: QueryFilter.FieldOptions.MaxPlayers,
    11.             //         op: QueryFilter.OpOptions.EQ,
    12.             //         value: "2")
    13.             // };
    14.            
    15.             Lobby lobby = await LobbyService.Instance.QuickJoinLobbyAsync(options);
    16.  
    17.  
    18.         }
    19.         catch (LobbyServiceException e)
    20.         {
    21.             Debug.Log(e);
    22.             if (e.Reason == LobbyExceptionReason.LobbyConflict)
    23.             {
    24.                
    25.             }
    26.         }
    27.     }
    The problem is that it throws an error even if is inside the try-catch:
    [Lobby]: NoOpenLobbies, (16006). Message: failed to find any open lobbies matching the search criteria

    The "reason" inside the LobbyServiceException is that there is no lobby, but I should be able to get into the Catch and not throw any error.
     

    Attached Files:

  2. lavagoatGG

    lavagoatGG

    Joined:
    Apr 16, 2022
    Posts:
    229
    Maybe Lobby lobby = await Lobbies.Instance.QuickJoinLobbyAsync(options); instead of
    Lobby lobby = await LobbyService.Instance.QuickJoinLobbyAsync(options);
     
  3. Max_power1965

    Max_power1965

    Joined:
    Oct 31, 2013
    Posts:
    127
    Nope, same error, and btw the official documentation says to use the
    LobbyService.Instance.QuickJoinLobbyAsync(options) method.
     
  4. lavagoatGG

    lavagoatGG

    Joined:
    Apr 16, 2022
    Posts:
    229
    I am using Lobbies and It also doesn't get into the catch. Why does it matter if it logs an error or no?
     
  5. lavagoatGG

    lavagoatGG

    Joined:
    Apr 16, 2022
    Posts:
    229
    In my game, it does what is in the catch and also throws an exception
     
  6. Max_power1965

    Max_power1965

    Joined:
    Oct 31, 2013
    Posts:
    127
    You seamply should have errors your code, and since I'm using the official API this shouldn't happen. I wanted to know if the API is broken or if I'm doing something wrong
     
  7. atmuc

    atmuc

    Joined:
    Feb 28, 2011
    Posts:
    1,151
    I have the same problem. I follow this tutorial;



    I use parrelsync. Both project copies create a new lobby. Sometimes they find the best region different.
     
  8. atmuc

    atmuc

    Joined:
    Feb 28, 2011
    Posts:
    1,151
    Even QueryLobbiesAsyncfind a lobby, QuickJoinLobbyAsync can not find a lobby.

    Code (CSharp):
    1. List<Lobby> lobbies = (await LobbyService.Instance.QueryLobbiesAsync()).Results;
    2.                 foreach (Lobby lobby2 in lobbies)
    3.                 {
    4.                     Debug.Log(lobby2.LobbyCode);
    5.                 }
    Authenticating anonymously generates the same Player Id on 2 unity projects. Can this cause that problem?

    upload_2022-9-26_11-7-19.png
     
  9. lavagoatGG

    lavagoatGG

    Joined:
    Apr 16, 2022
    Posts:
    229
    I don't know what parralel sync is, but QuickJoinLobby works for me on different devices.
     
  10. atmuc

    atmuc

    Joined:
    Feb 28, 2011
    Posts:
    1,151
    lavagoatGG likes this.
  11. veleek_unity

    veleek_unity

    Ben Randall Unity Technologies

    Joined:
    Aug 25, 2021
    Posts:
    59
    @Max_power1965 - Correct me if I'm wrong, I think that you're just referring to the fact that an error message gets logged in the console even though you're catching the exception, right? If so, this is a know issue. The Lobby SDK is a little aggressive with logging errors in ADDITION to throwing exception for you to catch. We're making some adjustments to prevent it from logging theses errors automatically. For now, as long as you're catching the exception, you can just ignore that additional (but annoying) error log.

    @atmuc - You can't QuickJoin a lobby if you're the "host" of the lobby (e.g. if the
    HostId
    property of the Lobby is the same as the logged in Player ID). The Lobby service will filter out all lobbies that you're the host of so you'll see the error "can not find a lobby" even though QueryLobbiesAsync will still return that lobby.

    I believe that by default ParrelSync will log you in with the same user. There's an extra flag, or some property you need to set in one of the instances to force it to use a different Anonymous user, and then QuickJoin should work properly.
     
    lavagoatGG likes this.
  12. veleek_unity

    veleek_unity

    Ben Randall Unity Technologies

    Joined:
    Aug 25, 2021
    Posts:
    59
Thread Status:
Not open for further replies.