Search Unity

Delete cache

Discussion in 'Unity Remote Config' started by julien-b, Feb 5, 2020.

  1. julien-b

    julien-b

    Joined:
    May 8, 2015
    Posts:
    31
    Hi,
    I'm trying to trigger the ConfigOrigin.Default behavior with ApplyRemoteSettings, but I can't find where the cache is on macOS. It always triggers ConfigOrigin.Cached.
    Can you help ?
     
  2. vd_unity

    vd_unity

    Unity Technologies

    Joined:
    Sep 11, 2014
    Posts:
    41
    Hi @julien-b.
    Locally on your mac, cached file from remote config is usually at
    /Users/your-name/Library/Application Support/DefaultCompany/your-project-name/RemoteConfig.json
     
  3. rambod

    rambod

    Unity Technologies

    Joined:
    Mar 2, 2018
    Posts:
    58
    Hey @julien-b, just as a heads up, the ConfigOrigin.Default behavior will only (currently) happen if you query the ConfigManager before its been initialized. This is more future proofing for when we move to async cache reads/writes, at which point, depending on the size of the cache, on initialization the cache might not be loaded yet.

    Hope this helps shine some light into what's happening under the covers.
     
  4. krisventure

    krisventure

    Joined:
    Mar 24, 2016
    Posts:
    118
    Strangely, ApplyRemoteSettings currently returns ConfigOrigin.Remote value even when I turn off internet and there is no connection at all. This is my code and it worked well a year ago when I tested but I guess maybe in Unity 2020 it's broken because it always returns the Remote value.


    Code (CSharp):
    1.     void ApplyRemoteSettings(ConfigResponse configResponse)
    2.     {
    3.         // Conditionally update settings, depending on the response's origin:
    4.         switch (configResponse.requestOrigin)
    5.         {
    6.             case ConfigOrigin.Default:
    7.                 Debug.Log("No settings loaded this session; using default values.");
    8.                 if (IsLaunchScene())
    9.                     GetComponent<LevelManager>().OnRemoteSettingsFetched();
    10.                 break;
    11.             case ConfigOrigin.Cached:
    12.                 Debug.Log("No settings loaded this session; using cached values from a previous session.");
    13.                 ApplyRemoteOrCachedConfigSettings();
    14.                 break;
    15.             case ConfigOrigin.Remote:
    16.                 Debug.Log("New settings loaded this session.");
    17.                 ApplyRemoteOrCachedConfigSettings();
    18.                 break;
    19.         }
     
  5. krisventure

    krisventure

    Joined:
    Mar 24, 2016
    Posts:
    118
    This was fixed after we've updated our Remote Config version from 1.4.0 (current 'verified') to the latest 2.1.2. Either way, may be worth to fix the bug in 1.4.0 or remove the 'verified' label on it.
     
  6. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    We did "fix the bug in 1.4.0". When a bug is fixed, the fix comes out in a new version. If we updated "in place", then some users would have a "good" version of 1.4.0 while others would have the "bad" version of 1.4.0. How would you the developer know which one you have? That is the reason for versioning. Verified does not mean "no bugs", all software will always have bugs.