Search Unity

Remote Config works in the editor, but not in the Build

Discussion in 'Unity Remote Config' started by bruceweir1, Jan 10, 2021.

  1. bruceweir1

    bruceweir1

    Joined:
    Nov 29, 2017
    Posts:
    15
    Unity 2019.4.11
    Remote Config 1.0.9

    I am pulling in a Remote Configuration value when the application starts up, and it works as expected when running in the editor, but when running in the build no keys are returned even though
    Code (CSharp):
    1. configResponse.status
    reports "Success".

    Here is the class doing the work:

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using Unity.RemoteConfig;
    5. using System;
    6.  
    7. namespace GameServices
    8. {
    9.     public class RemoteSettings : MonoBehaviour
    10.     {
    11.         public delegate void ServerListAddressChanged(string serverListAddress);
    12.         public static event ServerListAddressChanged onServerListAddressChanged;
    13.         public string serverListAddress;
    14.  
    15.         public struct userAttributes { }
    16.  
    17.         public struct appAttributes { }
    18.  
    19.         public void Awake()
    20.         {
    21.             ConfigManager.FetchCompleted += ApplyRemoteSettings;
    22.  
    23.             ConfigManager.FetchConfigs<userAttributes, appAttributes>(new userAttributes(), new appAttributes());
    24.         }
    25.  
    26.         private void ApplyRemoteSettings(ConfigResponse configResponse)
    27.         {
    28.  
    29.             Debug.Log("configResponse.requestOrigin: " + configResponse.requestOrigin);
    30.             Debug.Log("configResponse.status: " + configResponse.status);
    31.  
    32.             Debug.Log("RemoteSettings keys");
    33.             foreach (string key in ConfigManager.appConfig.GetKeys())
    34.             {
    35.                 Debug.Log("key: " + key);
    36.             }
    37.  
    38.             if (ConfigManager.appConfig.HasKey("server_list"))
    39.             {
    40.  
    41.                 serverListAddress = ConfigManager.appConfig.GetString("server_list");
    42.  
    43.                 if (onServerListAddressChanged != null)
    44.                 {
    45.                     onServerListAddressChanged(serverListAddress);
    46.                 }
    47.             }
    48.             else
    49.             {
    50.                 //add hardcoded as a workaround
    51.                 if (onServerListAddressChanged != null)
    52.                 {
    53.                     onServerListAddressChanged("http://[blah]");
    54.                 }
    55.             }
    56.         }
    57.  
    58.     }
    59. }

    Is there some setting on the Dashboard to make it work for builds?
     
  2. bruceweir1

    bruceweir1

    Joined:
    Nov 29, 2017
    Posts:
    15
    Upgrading the package to version 2.0.1 has fixed the problem. This is a bit odd since 1.0.9 is 'verified'.
     
  3. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    You are using code that is associated with 2.*, so the behavior is expected.