Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Bug Lobby Joining Error

Discussion in 'Lobby' started by unity_Wzp0iq7iZdm0CA, Feb 17, 2024.

  1. unity_Wzp0iq7iZdm0CA

    unity_Wzp0iq7iZdm0CA

    Joined:
    Jun 20, 2020
    Posts:
    6
    So basically whenever I enter lobby code to join lobby, sometimes it works but sometimes it gives me exception. Please help me: This is the error:

    Multiplayer QuickJoinLobby Esxception at Unity.Services.Lobbies.Internal.WrappedLobbyService.ResolveErrorWrapping (Unity.Services.Lobbies.LobbyExceptionReason reason, System.Exception exception) [0x0009d] in C:\Unity Projects\CopChase\CopChase\Library\PackageCache\com.unity.services.lobby@1.1.2\Runtime\SDK\WrappedLobbyService.cs:459
    at Unity.Services.Lobbies.Internal.WrappedLobbyService.TryCatchRequest[TRequest,TReturn] (System.String api, System.Func`3[T1,T2,TResult] func, TRequest request) [0x000db] in C:\Unity Projects\CopChase\CopChase\Library\PackageCache\com.unity.services.lobby@1.1.2\Runtime\SDK\WrappedLobbyService.cs:402
    at Unity.Services.Lobbies.Internal.WrappedLobbyService.JoinLobbyByCodeAsync (System.String lobbyCode, Unity.Services.Lobbies.JoinLobbyByCodeOptions options) [0x000a1] in C:\Unity Projects\CopChase\CopChase\Library\PackageCache\com.unity.services.lobby@1.1.2\Runtime\SDK\WrappedLobbyService.cs:161
    at Unity.Services.Lobbies.Internal.WrappedLobbyService.JoinLobbyByCodeAsync (System.String lobbyCode, Unity.Services.Lobbies.JoinLobbyByCodeOptions options) [0x001c7] in C:\Unity Projects\CopChase\CopChase\Library\PackageCache\com.unity.services.lobby@1.1.2\Runtime\SDK\WrappedLobbyService.cs:177
    at MultiplayerManager.QuickJoinLobby (System.String code) [0x00047] in C:\Unity Projects\CopChase\CopChase\Assets\scripts\MultiplayerManager.cs:237
    UnityEngine.Debug:Log (object)
    MultiplayerManager/<QuickJoinLobby>d__35:MoveNext () (at Assets/scripts/MultiplayerManager.cs:251)
    System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.Lobbies.Models.Lobby>:SetException (System.Exception)
    Unity.Services.Lobbies.Internal.WrappedLobbyService/<JoinLobbyByCodeAsync>d__15:MoveNext () (at Library/PackageCache/com.unity.services.lobby@1.1.2/Runtime/SDK/WrappedLobbyService.cs:177)
    System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.Lobbies.Response`1<Unity.Services.Lobbies.Models.Lobby>>:SetException (System.Exception)
    Unity.Services.Lobbies.Internal.WrappedLobbyService/<TryCatchRequest>d__26`2<Unity.Services.Lobbies.Lobby.JoinLobbyByCodeRequest, Unity.Services.Lobbies.Models.Lobby>:MoveNext () (at Library/PackageCache/com.unity.services.lobby@1.1.2/Runtime/SDK/WrappedLobbyService.cs:433)
    System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.Lobbies.Response`1<Unity.Services.Lobbies.Models.Lobby>>:SetException (System.Exception)
    Unity.Services.Lobbies.Apis.Lobby.LobbyApiClient/<JoinLobbyByCodeAsync>d__15:MoveNext () (at Library/PackageCache/com.unity.services.lobby@1.1.2/Runtime/Apis/LobbyApi.cs:478)
    System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.Lobbies.Http.HttpClientResponse>:SetResult (Unity.Services.Lobbies.Http.HttpClientResponse)
    Unity.Services.Lobbies.Http.HttpClient/<MakeRequestAsync>d__1:MoveNext () (at Library/PackageCache/com.unity.services.lobby@1.1.2/Runtime/Http/HttpClient.cs:41)
    System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.Lobbies.Http.HttpClientResponse>:SetResult (Unity.Services.Lobbies.Http.HttpClientResponse)
    Unity.Services.Lobbies.Http.HttpClient/<CreateWebRequestAsync>d__3:MoveNext () (at Library/PackageCache/com.unity.services.lobby@1.1.2/Runtime/Http/HttpClient.cs:56)
    System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.Lobbies.Http.HttpClientResponse>:SetResult (Unity.Services.Lobbies.Http.HttpClientResponse)
    Unity.Services.Lobbies.Http.HttpClient/<CreateHttpClientResponse>d__4:MoveNext () (at Library/PackageCache/com.unity.services.lobby@1.1.2/Runtime/Http/HttpClient.cs:84)
    System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.Lobbies.Http.HttpClientResponse>:SetResult (Unity.Services.Lobbies.Http.HttpClientResponse)
    Unity.Services.Lobbies.Http.HttpClient/<>c__DisplayClass4_0/<<CreateHttpClientResponse>b__0>d:MoveNext () (at Library/PackageCache/com.unity.services.lobby@1.1.2/Runtime/Http/HttpClient.cs:81)
    System.Threading.Tasks.TaskCompletionSource`1<Unity.Services.Lobbies.Http.HttpClientResponse>:SetResult (Unity.Services.Lobbies.Http.HttpClientResponse)
    Unity.Services.Lobbies.Http.UnityWebRequestHelpers/<>c__DisplayClass0_0:<GetAwaiter>b__0 (UnityEngine.AsyncOperation) (at Library/PackageCache/com.unity.services.lobby@1.1.2/Runtime/Http/UnityWebRequestHelpers.cs:34)
    UnityEngine.AsyncOperation:InvokeCompletionEvent ()



    This is the code:

    async Task CreateLobby()
    {
    canvasmanager.HostedIpAddressText.text = "loading..";
    try
    {
    Allocation allocation = await AllocationRelay();
    string relayJoinCode = await GetRelayJoinCode(allocation);
    lobbyName = RandomLobbyName();
    CreateLobbyOptions options = new CreateLobbyOptions {
    IsPrivate = false,
    Player = player(),
    Data = new Dictionary<string, DataObject>
    {{k_keyJoinCode, new DataObject(DataObject.VisibilityOptions.Public,relayJoinCode)}},
    };
    currentlobby = await LobbyService.Instance.CreateLobbyAsync(lobbyName, 2,options);
    heartbeatTimer.Start();
    pollForUpdatesTimer.Start();
    canvasmanager.HostedIpAddressText.text = "loading..";
    Debug.Log("Multiplayer CreateLobby Name: " + currentlobby.Name + " with code " + currentlobby.LobbyCode);
    JoinLobbyCode = currentlobby.LobbyCode;
    canvasmanager.HostedIpAddressText.text = JoinLobbyCode;
    sharecodetext.text = JoinLobbyCode;
    NetworkManager.Singleton.GetComponent<UnityTransport>().SetRelayServerData(new RelayServerData(allocation, connectionType));
    NetworkManager.Singleton.StartHost();
    PrintPlayersHost();
    Debug.Log("Multiplayer CreateLobby LobbyCode: " + JoinLobbyCode + " RelayCode: " + relayJoinCode);
    }
    catch (LobbyServiceException e)
    {
    Debug.Log("Multiplayer CreateLobby Exception: " + e);
    CreateLobby();
    }

    }

    async Task QuickJoinLobby(string code)
    {
    try
    {
    JoinLobbyByCodeOptions joinLobbyByCodeOptions = new JoinLobbyByCodeOptions
    {
    Player = player(),
    };
    currentlobby = await LobbyService.Instance.JoinLobbyByCodeAsync(code,joinLobbyByCodeOptions);
    pollForUpdatesTimer.Start();
    Debug.Log("Multiplayer QuickJoinLobby CurrentLobby: " + currentlobby.Id);
    canvasmanager.HostedIpAddressText.text = code;
    sharecodetext.text = code;
    string relayJoinCode = currentlobby.Data[k_keyJoinCode].Value;
    JoinAllocation joinAllocatiion = await JoinRelay(relayJoinCode);
    NetworkManager.Singleton.GetComponent<UnityTransport>().SetRelayServerData(new RelayServerData(joinAllocatiion, connectionType));
    NetworkManager.Singleton.StartClient();
    PrintPlayersHost();
    Debug.Log("Multiplayer QuickJoinLobby LobbyCode: " + code + " RelayCode: " + relayJoinCode);
    }
    catch(LobbyServiceException e)
    {
    Debug.Log("Multiplayer QuickJoinLobby Esxception " + e.StackTrace);
    }
    }
     
  2. unity_Wzp0iq7iZdm0CA

    unity_Wzp0iq7iZdm0CA

    Joined:
    Jun 20, 2020
    Posts:
    6
    Someone Please help me