Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question KeyNotFoundException: There is no component `IAccessToken` registered.

Discussion in 'Unity Remote Config' started by mhardy, Nov 3, 2021.

  1. mhardy

    mhardy

    Joined:
    Apr 3, 2011
    Posts:
    47
    I had RemoteConfig working in Unity 2019.4.29f1. We decided to upgrade to 2021.2 and now RemoteConfig no longer works.

    I can Push & Pull from the Remote Config window in the editor, but when I hit Play my RemoteConfigManager throws an exception when it tries to fetch.

    I can't find anything about a Unity IAccessToken component.

    Any idea what this is?


    KeyNotFoundException: There is no component `IAccessToken` registered. Are you missing a package?
    Unity.Services.Core.Internal.ComponentRegistry.GetServiceComponent[TComponent] () (at Library/PackageCache/com.unity.services.core@1.1.0-pre.10/Runtime/Core.Internal/Registry/ComponentRegistry/ComponentRegistry.cs:50)
    Unity.Services.Core.Internal.CoreRegistry.GetServiceComponent[TComponent] () (at Library/PackageCache/com.unity.services.core@1.1.0-pre.10/Runtime/Core.Internal/Registry/CoreRegistry.cs:92)
    Unity.RemoteConfig.ConfigManager.get_ConfigManagerImpl () (at Library/PackageCache/com.unity.remote-config-runtime@3.0.0-pre.10/Runtime/ConfigManager.cs:36)
    Unity.RemoteConfig.ConfigManager.add_FetchCompleted (System.Action`1[T] value) (at Library/PackageCache/com.unity.remote-config-runtime@3.0.0-pre.10/Runtime/ConfigManager.cs:81)
    RemoteConfigManager.FetchRemoteConfig () (at Assets/_Game/Code/GameStructure/RemoteConfigManager.cs:52)
    RemoteConfigManager.Awake () (at Assets/_Game/Code/GameStructure/RemoteConfigManager.cs:19)
     
    SebT_Unity likes this.
  2. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    176
    Hi mhardy,

    Thanks for posting.

    Could you share what version of the remote config package you are using?
    You could find this by going to WINDOW > PACKAGE MANAGER
    Search packages within your project and you will see a version number.

    Would it also be possible to share your Organization Name so I can do some further investigation on your org? You can share that information in a direct message by clicking on my name and starting a conversation.

    Thanks for the additional details.
     
  3. mhardy

    mhardy

    Joined:
    Apr 3, 2011
    Posts:
    47
    I was using "3.0.0-pre.3". I just tried "3.0.0-pre.4" but same problem so I tried the release version of 2.1.2 and it fixed it!

    It also appears to have fixed "A Native Collection has not been disposed, resulting in a memory leak". Which looks like it might have been this. But rolling back to 2.1.2 fixed that as well.
     
    SebT_Unity likes this.
  4. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    176
    Hi mhardy,

    Thanks for sharing your workaround and all your help in direct messages for confirming that the solution below works.

    For anyone who wants to continue with version 3.0.0 and up please continue reading below.

    For the new version of Remote config you would need to integrate the authentication service.
    Here is additional documentation for the code integration in 3.0.0 and up

    A quick extract of what would need to be done.
    Import the package within your manifest.json located under Packages/manifest.json
    Code (CSharp):
    1.  
    2. using Unity.Services.Core;
    3. using Unity.RemoteConfig;
    4. using Unity.Services.Authentication;
    5.  
    Followed by initializing anonymous user
    Code (CSharp):
    1.  
    2. async void Start () {
    3.         await UnityServices.InitializeAsync();
    4.         if (!AuthenticationService.Instance.IsSignedIn)
    5.         {
    6.             await AuthenticationService.Instance.SignInAnonymouslyAsync();
    7.         }
    8. }
    9.  
    Best,
    Sebastiano
     
    unity_Ctri, tagh and vd_unity like this.