Updated lobby doesn't appear

Hello,
I meet an issue when I update a lobby: the lobby doesn’t appear any more when I get the lobbies list.
I followed the tutorial of CodeMonkey, and it works fine.

But when I add:

Lobby lobby = await Lobbies.Instance.UpdateLobbyAsync(joinedLobby.Id, new UpdateLobbyOptions {
    Data = new Dictionary<string, DataObject> {
        { "KEY_START_GAME", new DataObject(DataObject.VisibilityOptions.Member, relayCode)}
    }
});

The lobby is not shown any more, but it still exists I think as I can get the relay code.

I create the allocation just after the lobby creation, not sure if it can cause the issue.

How long after the creation do you update and how long after that do you get the lobby list?

I update almost imediately after (I only create the relay before which is very fast).
And the lobby list is displayed after that, just the time to click on a button so maybe 1-2 seconds.

Could you share your code for the lobby creation and the query as well (I’m assuming by “get the lobbies list”, you mean query)?

Sure.
The entire function CreateLobby:

try {
            CreateLobbyOptions createLobbyOptions = new CreateLobbyOptions {
                IsPrivate = LobbyData.is_private,
                Player = GetPlayer(),
                Data = new Dictionary<string, DataObject> {
                    { "GameMode", new DataObject(DataObject.VisibilityOptions.Public, LobbyData.game_mode) },
                    { "Map", new DataObject(DataObject.VisibilityOptions.Public, LobbyData.game_map) },
                    { "ModifierOutbreak", new DataObject(DataObject.VisibilityOptions.Public, LobbyData.modifier_outbreak) },
                    { "ModifierTiers1", new DataObject(DataObject.VisibilityOptions.Public, LobbyData.modifier_tiers1) },
                    { "ModifierBuildings", new DataObject(DataObject.VisibilityOptions.Public, LobbyData.modifier_buildings) },
                    { "ModifierStorm", new DataObject(DataObject.VisibilityOptions.Public, LobbyData.modifier_storm) },
                    { "ModifierRifle", new DataObject(DataObject.VisibilityOptions.Public, LobbyData.modifier_rifle) },
                    { "Modifier1Life", new DataObject(DataObject.VisibilityOptions.Public, LobbyData.modifier_1life) },
                    { "ModifierTraining", new DataObject(DataObject.VisibilityOptions.Public, LobbyData.modifier_training_mode) },
                    { "KEY_START_GAME", new DataObject(DataObject.VisibilityOptions.Member, "0") }
                }
            };

            Lobby lobby = await LobbyService.Instance.CreateLobbyAsync(LobbyData.game_description, LobbyData.max_players, createLobbyOptions);

            hostLobby = lobby;
            joinedLobby = hostLobby;

            nb_players.text = (lobby.MaxPlayers - lobby.AvailableSlots) + " / " + lobby.MaxPlayers;

            lobby_code_input.GetComponent<TMP_InputField>().text = lobby.LobbyCode;

            Debug.Log("Create Lobby: " + lobby.Name + " (" + lobby.Id + ") map: " + lobby.Data["Map"].Value + " / " + lobby.Data["GameMode"].Value + " " + lobby.MaxPlayers + " - " + lobby.LobbyCode);

            DisplayPlayers();
        } catch (LobbyServiceException e) {
            Debug.Log(e);
        }
       
        try {
            string relayCode = await CreateRelay();

           Lobby lobby = await Lobbies.Instance.UpdateLobbyAsync(joinedLobby.Id, new UpdateLobbyOptions {
                Data = new Dictionary<string, DataObject> {
                    { "KEY_START_GAME", new DataObject(DataObject.VisibilityOptions.Member, relayCode)}
                }
            });

            joinedLobby = lobby;

            Debug.Log("Lobby relay code: " + lobby.Data["KEY_START_GAME"].Value);
            Debug.Log("Relay code: " + relayCode);
        } catch (LobbyServiceException e) {
            Debug.Log(e);
        }

The function DisplayLobbies:

        try {
            QueryLobbiesOptions queryLobbiesOptions = new QueryLobbiesOptions {
                Count = 25,
                Filters = new List<QueryFilter> {
                    new QueryFilter(QueryFilter.FieldOptions.AvailableSlots, "0", QueryFilter.OpOptions.GT)
                },
                Order = new List<QueryOrder> {
                    new QueryOrder(false, QueryOrder.FieldOptions.Created)
                }
            };
            QueryResponse queryResponse = await Lobbies.Instance.QueryLobbiesAsync(queryLobbiesOptions);

            nb_platoons_found.text = queryResponse.Results.Count.ToString();
        } catch (LobbyServiceException e) {
            Debug.Log(e);
        }

If I comment the code in my first post above, it works well.

I wonder if it could work to create the relay first. It would avoid a lobby update.

And just to clarify, is your LobbyData.is_private value false?

You’re right that you should be able to create the relay first, but in theory, the update you’re making here doesn’t seem like it should affect anything about the lobby showing up in queries.

Yes, it is set to public (true).

I will try that but it seems strange. Maybe it doesn’t matter in most cases if people update the lobby just before to destroy it (as players go in the game) so it is probably not displayed. This is what CodeMonkey showed. But I want to display the regions in the lobby list host so I have to set Relay early.

If you set the IsPrivate variable to true, it will be set to private.

Oh, I will check but it it must be false then ^^
It was displayed before I add Relay and “public” was displayed on the lobby window.

It is set to “false”.

However I forgot to mention that I get an error quite obscure sometimes. It seems related to Relay.
I wanted to investigate later as it doesn’t mean anything to me but maybe it is linked. I don’t know.

The error:

Unable to find internal function Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle::CheckWriteAndBumpSecondaryVersion_Injected
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Burst.Compiler.IL.Jit.JitBurstInitializeUtility:InvokeBurstInitializeFunction (intptr,string,intptr)
Burst.Compiler.IL.Client.CompilerClient/LoadedLibrary:EnsureInitialized (intptr)
Burst.Compiler.IL.Client.CompilerClient:CallCallback (Burst.Compiler.IL.Client.CompilerClient/RequestedFunctionPointer,Burst.Compiler.IL.Client.CompilerClient/LoadedFunctionPointer)
Burst.Compiler.IL.Client.CompilerClient:HandleCompilationRequest (string,string[ ],Burst.Compiler.IL.Client.CompilerClientCompileStatusCallback,Burst.Compiler.IL.Jit.JitCompilerService/CompileCallbackDelegate,intptr,Burst.Compiler.IL.Jit.JitOptions,System.Nullable1<Burst.Compiler.IL.Jit.FunctionPointerStub>) Burst.Compiler.IL.Jit.JitCompilerService:CompileInternal (string,string,intptr,Unity.Burst.NativeDumpFlags,intptr,intptr,string) Unity.Burst.BurstCompiler:Compile (object,System.Reflection.MethodInfo,bool,bool) (at Library/PackageCache/com.unity.burst@1.8.2/Runtime/BurstCompiler.cs:470) Unity.Burst.BurstCompiler:Compile (object,bool) (at Library/PackageCache/com.unity.burst@1.8.2/Runtime/BurstCompiler.cs:335) Unity.Burst.BurstCompiler:CompileFunctionPointer<Unity.Networking.Transport.NetworkProtocol/ComputePacketOverheadDelegate> (Unity.Networking.Transport.NetworkProtocol/ComputePacketOverheadDelegate) (at Library/PackageCache/com.unity.burst@1.8.2/Runtime/BurstCompiler.cs:317) Unity.Networking.Transport.TransportFunctionPointer1<Unity.Networking.Transport.NetworkProtocol/ComputePacketOverheadDelegate>:.ctor (Unity.Networking.Transport.NetworkProtocol/ComputePacketOverheadDelegate) (at Library/PackageCache/com.unity.transport@1.3.3/Runtime/TransportFunctionPointer.cs:19)
Unity.Networking.Transport.Relay.RelayNetworkProtocol:CreateProtocolInterface () (at Library/PackageCache/com.unity.transport@1.3.3/Runtime/Relay/RelayNetworkProtocol.cs:288)
Unity.Networking.Transport.NetworkDriver:.ctor (Unity.Networking.Transport.INetworkInterface,Unity.Networking.Transport.INetworkProtocol,Unity.Networking.Transport.NetworkSettings) (at Library/PackageCache/com.unity.transport@1.3.3/Runtime/NetworkDriver.cs:728)
Unity.Networking.Transport.NetworkDriver:.ctor (Unity.Networking.Transport.INetworkInterface,Unity.Networking.Transport.NetworkSettings) (at Library/PackageCache/com.unity.transport@1.3.3/Runtime/NetworkDriver.cs:648)
Unity.Networking.Transport.NetworkDriver:Create (Unity.Networking.Transport.NetworkSettings) (at Library/PackageCache/com.unity.transport@1.3.3/Runtime/NetworkDriver.cs:572)
Unity.Netcode.Transports.UTP.UnityTransport:CreateDriver (Unity.Netcode.Transports.UTP.UnityTransport,Unity.Networking.Transport.NetworkDriver&,Unity.Networking.Transport.NetworkPipeline&,Unity.Networking.Transport.NetworkPipeline&,Unity.Networking.Transport.NetworkPipeline&) (at Library/PackageCache/com.unity.netcode.gameobjects@1.3.1/Runtime/Transports/UTP/UnityTransport.cs:1566)
Unity.Netcode.Transports.UTP.UnityTransport:InitDriver () (at Library/PackageCache/com.unity.netcode.gameobjects@1.3.1/Runtime/Transports/UTP/UnityTransport.cs:473)
Unity.Netcode.Transports.UTP.UnityTransport:ServerBindAndListen (Unity.Networking.Transport.NetworkEndPoint) (at Library/PackageCache/com.unity.netcode.gameobjects@1.3.1/Runtime/Transports/UTP/UnityTransport.cs:572)
Unity.Netcode.Transports.UTP.UnityTransport:StartRelayServer () (at Library/PackageCache/com.unity.netcode.gameobjects@1.3.1/Runtime/Transports/UTP/UnityTransport.cs:703)
Unity.Netcode.Transports.UTP.UnityTransport:StartServer () (at Library/PackageCache/com.unity.netcode.gameobjects@1.3.1/Runtime/Transports/UTP/UnityTransport.cs:1354)
Unity.Netcode.NetworkManager:StartHost () (at Library/PackageCache/com.unity.netcode.gameobjects@1.3.1/Runtime/Core/NetworkManager.cs:1000)
LobbiesController/d__52:MoveNext () (at Assets/MAIN MENU/Scripts/LOBBY/LobbiesController.cs:603)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1<string>:SetResult (string) Unity.Services.Relay.WrappedRelayService/<GetJoinCodeAsync>d__7:MoveNext () (at Library/PackageCache/com.unity.services.relay@1.0.5/Runtime/SDK/WrappedRelayService.cs:131) System.Runtime.CompilerServices.AsyncTaskMethodBuilder1<Unity.Services.Relay.Response1<Unity.Services.Relay.Models.JoinCodeResponseBody>>:SetResult (Unity.Services.Relay.Response1<Unity.Services.Relay.Models.JoinCodeResponseBody>)
Unity.Services.Relay.Apis.RelayAllocations.RelayAllocationsApiClient/d__8:MoveNext () (at Library/PackageCache/com.unity.services.relay@1.0.5/Runtime/Apis/RelayAllocationsApi.cs:160)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1<Unity.Services.Relay.Http.HttpClientResponse>:SetResult (Unity.Services.Relay.Http.HttpClientResponse) Unity.Services.Relay.Http.HttpClient/<MakeRequestAsync>d__1:MoveNext () (at Library/PackageCache/com.unity.services.relay@1.0.5/Runtime/Http/HttpClient.cs:41) System.Runtime.CompilerServices.AsyncTaskMethodBuilder1<Unity.Services.Relay.Http.HttpClientResponse>:SetResult (Unity.Services.Relay.Http.HttpClientResponse)
Unity.Services.Relay.Http.HttpClient/d__3:MoveNext () (at Library/PackageCache/com.unity.services.relay@1.0.5/Runtime/Http/HttpClient.cs:56)
System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation:Run (System.Threading.Tasks.Task,bool)
Sys

Hello.

I don’t have any more the error above.
And I now create the Relay before the Lobby, but the Lobby still doesn’t appear with the query.

The function to create the lobby is now:

async public void CreateLobby()
    {
        string relayCode = await CreateRelay();
        Debug.Log("Relay code: " + relayCode);

        try {
            CreateLobbyOptions createLobbyOptions = new CreateLobbyOptions {
                IsPrivate = LobbyData.is_private,
                Player = GetPlayer(),
                Data = new Dictionary<string, DataObject> {
                    { "GameMode", new DataObject(DataObject.VisibilityOptions.Public, LobbyData.game_mode) },
                    { "Map", new DataObject(DataObject.VisibilityOptions.Public, LobbyData.game_map) },
                    { "ModifierOutbreak", new DataObject(DataObject.VisibilityOptions.Public, LobbyData.modifier_outbreak) },
                    { "ModifierTiers1", new DataObject(DataObject.VisibilityOptions.Public, LobbyData.modifier_tiers1) },
                    { "ModifierBuildings", new DataObject(DataObject.VisibilityOptions.Public, LobbyData.modifier_buildings) },
                    { "ModifierStorm", new DataObject(DataObject.VisibilityOptions.Public, LobbyData.modifier_storm) },
                    { "ModifierRifle", new DataObject(DataObject.VisibilityOptions.Public, LobbyData.modifier_rifle) },
                    { "Modifier1Life", new DataObject(DataObject.VisibilityOptions.Public, LobbyData.modifier_1life) },
                    { "ModifierTraining", new DataObject(DataObject.VisibilityOptions.Public, LobbyData.modifier_training_mode) },
                    { "KEY_START_GAME", new DataObject(DataObject.VisibilityOptions.Member, relayCode) }
                }
            };

            Lobby lobby = await LobbyService.Instance.CreateLobbyAsync(LobbyData.game_description, LobbyData.max_players, createLobbyOptions);

            hostLobby = lobby;
            joinedLobby = hostLobby;

            nb_players.text = (lobby.MaxPlayers - lobby.AvailableSlots) + " / " + lobby.MaxPlayers;

            lobby_code_input.GetComponent<TMP_InputField>().text = lobby.LobbyCode;

            Debug.Log("Create Lobby: " + lobby.Name + " (" + lobby.Id + ") map: " + lobby.Data["Map"].Value + " / " + lobby.Data["GameMode"].Value + " " + lobby.MaxPlayers + " - " + lobby.LobbyCode);
            Debug.Log("Lobby Relay code: " + lobby.Data["KEY_START_GAME"].Value);

            DisplayPlayers();
        } catch (LobbyServiceException e) {
            Debug.Log(e);
        }
    }

Is there anything with Relay that could block? If I don’t create the Relay, the lobby is displayed.

Can you submit a support request (using the Support link near the top of the page at Unity Cloud) so that we can get your org and project ids so we can troubleshoot this a little bit more. We don’t see anything obvious wrong and we’d like to dig in.

Can you also verify what value you’re using for MaxPlayers?

Sure.

MaxPlayers is set to 11 or 3.
Request sent.

The error was on my side.
Sorry.
Thanks for the support.