Multiplayer Framework - Host Authentication Service Sign In Error

Running into a blocker where I can’t host a game because the player is not signed in. I’m not sure if I missed a step somewhere, but I don’t remember there being one about setting up the Authentication services. There was definitely a Relay setup section, but the dashboard looks outdated so I had to do some fidgeting around. I also tried adding a Unity Player Account for the authentication, but I’m still getting the following error. I’m stumped. :tired_face:

Unity.Services.Relay.RelayServiceException: You are not signed in to the Authentication Service. Please sign in.
at Unity.Services.Relay.WrappedRelayService.EnsureSignedIn () [0x00022] in .\Library\PackageCache\com.unity.services.relay@1.0.5\Runtime\SDK\WrappedRelayService.cs:223
at Unity.Services.Relay.WrappedRelayService.CreateAllocationAsync (System.Int32 maxConnections, System.String region) [0x00019] in .\Library\PackageCache\com.unity.services.relay@1.0.5\Runtime\SDK\WrappedRelayService.cs:32
at HostGameManager.StartHostAsync () [0x0002d] in C:\PersonalProjects\unity-projects\UnityCourse06\Assets\Scripts\Networking\HostGameManager.cs:23
UnityEngine.Debug:LogError (object)
HostGameManager/d4:MoveNext () (at Assets/Scripts/Networking/HostGameManager.cs:27)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start<HostGameManager/d4> (HostGameManager/d4&)
HostGameManager:StartHostAsync ()
MainMenu/d0:MoveNext () (at Assets/Scripts/UI/MainMenu.cs:9)
System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start<MainMenu/d0> (MainMenu/d0&)
MainMenu:StartHost ()
UnityEngine.EventSystems.EventSystem:Update () (at ./Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:530)

I suppose it would help if my code was present for the portion responsible for deciding which authentication method is being used:

static async Task SignInAnonymously(int maxTries)

{

    AuthState = AuthState.Authenticated;

    int tries = 0;

    while (AuthState == AuthState.Authenticating && tries < maxTries)

    {

        try

        {

            await AuthenticationService.Instance.SignInAnonymouslyAsync(); //This can be changed depending on what for of authentication the project requires. SignInAnonymouslyAsync states it does not have to be on a publishing platform, i.e. Google Playstore, Apple, Steam, etc.

            if(AuthenticationService.Instance.IsSignedIn && AuthenticationService.Instance.IsAuthorized)

            {

                AuthState = AuthState.Authenticated;

                break;

            }

        }

        catch(AuthenticationException authException)

        {

            Debug.LogError(authException);

            AuthState = AuthState.Error;

        }

        catch(RequestFailedException requestException)

        {

            Debug.LogError(requestException);

            AuthState = AuthState.Error;

        }

        tries++;

        await Task.Delay(1000);

    }

    if(AuthState != AuthState.Authenticated)

    {

        Debug.LogWarning($"Player was not signed in successfully after {tries} tries.");

        AuthState = AuthState.TimeOut;

    }

}

Privacy & Terms