Search Unity

If I was offline when I first ran the game,what configuration will I read?

Discussion in 'Unity Remote Config' started by Sligh, Nov 20, 2019.

  1. Sligh

    Sligh

    Joined:
    Jun 21, 2018
    Posts:
    1
    It seems that I will read the default value of the data structure.
    Can I define a local default configuration?
    Or I only can fill in the default values in the default parameters of the Get function?
     
  2. dohaiha930

    dohaiha930

    Joined:
    Mar 27, 2018
    Posts:
    55
    Check on Remote Config, you can see they only fire Event with Switch case:
    Cache / Fail / Success.
    Just do what you want on that switch case.

    Code (CSharp):
    1. // Retrieve and apply the current key-value pairs from the service on Awake:
    2.     void Awake () {
    3.         // Add a listener to apply settings when successfully retrieved:
    4.         ConfigManager.FetchCompleted += ApplyRemoteSettings;
    5.         // Fetch configuration setting from the remote service:
    6.         ConfigManager.FetchConfigs<userAttributes, appAttributes>(new userAttributes(), new appAttributes());
    7.     }
    8.     void ApplyRemoteSettings (ConfigResponse configResponse) {
    9.         // Conditionally update settings, depending on the response's origin:
    10.         switch (configResponse.requestOrigin) {
    11.             case ConfigOrigin.Default:
    12.                 Debug.Log ("Load fail! Use DEFAULT");
    13.                 break;
    14.             case ConfigOrigin.Cached:
    15.                 Debug.Log ("Load fail! Use Cached");
    16.                 break;
    17.             case ConfigOrigin.Remote:
    18.                 Debug.Log ("Success Load Settings From Server!");
    19.                 break;
    20.         }
    21.     }
    22.  
     
    rambod and SamOYUnity3D like this.
  3. rambod

    rambod

    Unity Technologies

    Joined:
    Mar 2, 2018
    Posts:
    58
    @Sligh a local default config is something we're exploring, but currently the best way would be to initialize the variables to the best default and pass that in as the default value.
     
  4. plotlessplot

    plotlessplot

    Joined:
    Sep 16, 2012
    Posts:
    29
    Sorry to reopen this, but I wanted to know if you are still considering implementing a local default config so we can load a valid configuration solely through RemoteConfig even if the player is offline when they start up the game.
     
  5. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Do you plan to change the default values often? Otherwise the default GET values should work, can you show your code?