Issue with creating Lobby on build

Hi,
I’m trying to make Lobby work but I have an issue when building my game.

I have a UGSManager.cs which logs player in and call
await UnityServices.InitializeAsync();

Then, I have a button that create a Lobby with the following code:

    public async Task CreateLobby(string lobbyName, int maxPlayer, Dictionary<string, DataObject> datas = null, bool isPrivate = true)
    {
        try
        {
            Debug.LogError($"<color=#FFA500>[UGSLobbyManager]</color> <color=#7999ea>[CreateLobby]</color> => START creating lobby {lobbyName}.");

            CreateLobbyOptions options = new CreateLobbyOptions();
            options.IsPrivate = isPrivate;
            options.Data = datas;

            CurrentLobby = await LobbyService.Instance.CreateLobbyAsync(lobbyName, maxPlayer, options);

            RegisterLobbyEventCallbacks();

            Debug.LogError($"<color=#FFA500>[UGSLobbyManager]</color> <color=#7999ea>[CreateLobby]</color> => END creating lobby {lobbyName}.");
        }
        catch (LobbyServiceException e)
        {
            Debug.LogError($"<color=#FFA500>[UGSLobbyManager]</color> <color=#7999ea>[CreateLobby]</color> => ERROR creating lobby {lobbyName}. Error message : {e.Message} | {e.ErrorCode} | {e.Reason} | {e.ApiError}");
        }

When I test this in editor, it works fine (the lobby is created as it should).

But when I build my game and try the same thing on the built version, I have the following error:
Unable to get ILobbyServiceSdk because Lobby API is not initialized. Make sure you call UnityServices.InitializeAsync().

I’ve tried to place the UnityServices.InitializeAsync() in the CreateLobby function, just in case something went wrong in the Authentication, but the same message appears. I have Friends working fine, so it looks like UnityServices is correctly initialized.

Does someone have any idea on what might be the issue?

I tried adding a log for UnityServices state using:
Debug.LogError($"Unity Services Initialization State: {UnityServices.State}");

which returned that is was Initialized.

Hi @Adurnha,
Thank you for the report !

Could you please share with us a few more info to help us investigate ?

  • The version of the Lobby SDK (or the Multiplayer SDK) you use
  • Your Unity version
  • A minimal reproducible project would greatly help us if you can share one with us. You can send it either here or by creating a Bug Report in the Unity Editor following this step by step guide and proving us with the case number