Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Error on SignInAnonymouslyAsync

Discussion in 'Unity Remote Config' started by Max_power1965, Aug 18, 2022.

  1. Max_power1965

    Max_power1965

    Joined:
    Oct 31, 2013
    Posts:
    127
    Hello,
    i'm using the following code to initialize remote config :

    Code (CSharp):
    1. private static async Task InitializeRemoteConfigAsync()
    2.     {
    3.         if (UnityServices.State == ServicesInitializationState.Uninitialized)
    4.         {
    5.  
    6.             try
    7.             {
    8.                 await UnityServices.InitializeAsync();
    9.             }
    10.             catch (Exception ex)
    11.             {
    12.                 Debug.LogError("Unity service autentication faled in InitializeRemoteConfigAsync methos. Error " + ex.Message);
    13.             }
    14.             // initialize handlers for unity game services
    15.            
    16.         }
    17.  
    18.         // options can be passed in the initializer, e.g if you want to set analytics-user-id or an environment-name use the lines from below:
    19.         // var options = new InitializationOptions()
    20.         //   .SetOption("com.unity.services.core.analytics-user-id", "my-user-id-1234")
    21.         //   .SetOption("com.unity.services.core.environment-name", "production");
    22.         // await UnityServices.InitializeAsync(options);
    23.  
    24.         // remote config requires authentication for managing environment information
    25.         if (!AuthenticationService.Instance.IsSignedIn)
    26.         {
    27.  
    28.             try
    29.             {
    30.                 await AuthenticationService.Instance.SignInAnonymouslyAsync();
    31.             }
    32.             catch (Exception ex)
    33.             {
    34.                 Debug.LogError("SignInAnonymouslyAsync in InitializeRemoteConfigAsync methos. Error " + ex.Message);
    35.             }
    36.  
    37.         }
    38.     }
    Everything works fine on the Editor, I'm also able to retrieve the data from the remote Config backend, the problem is when I built on the device where I get the error that you can find attached, What I'm doing wrong?
     

    Attached Files:

  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I will check, the code looks correct. What version of RC are you using?
     
  3. Max_power1965

    Max_power1965

    Joined:
    Oct 31, 2013
    Posts:
    127
    JeffDUnity3D likes this.