Updating remote values at intervals

Hi,

Is it possible to call FetchConfigs multiple times during the game’s lifetime?

I would like to pull values every 10 minutes to ensure nothing has changed.

In my current implementation the first call to FetchConfigs works (pulls values from remote), then subsequent calls seem to do nothing. Am i missing something or is this not possible?

Thanks

Hi @Steve_Xisle ,

Yep, we’ve designed Remote Config to be called whenever you want, as many times as you want.

Can you paste a code snippet of how you’re fetching Remote Config? My first guess is that maybe there aren’t any changes between the first fetch and subsequent fetches, but seeing the code will help with that.

Sure, i’m using v1.0.6. The first call to Fetch() works fine, ApplyRemoteSettings is called. After that first time any subsequent calls to Fetch do not result in ApplyRemoteSettings being called

    public class UnityRemoteConfigService : IRemoteConfigService
    {
        private struct UserAttributes
        {
        }

        private struct AppAttributes
        {
        }

        private bool _fetched;

        public UnityRemoteConfigService()
        {
            ConfigManager.FetchCompleted += ApplyRemoteSettings;
        }

        public void Fetch()
        {
            Logger.Instance.LogInfo("Unity Remote Config: Fetching...");
            ConfigManager.FetchConfigs(new UserAttributes(), new AppAttributes());
        }

        private void ApplyRemoteSettings(ConfigResponse configResponse)
        {
            switch (configResponse.requestOrigin)
            {
                case ConfigOrigin.Default:
                    Logger.Instance.LogInfo("Unity Remote Config: No settings loaded this session; using default values.");
                    break;
                case ConfigOrigin.Cached:
                    Logger.Instance.LogInfo("Unity Remote Config: No settings loaded this session; using cached values from a previous session.");
                    break;
                case ConfigOrigin.Remote:
                    Logger.Instance.LogInfo("Unity Remote Config: New settings loaded this session; updating values accordingly.");
                    _fetched = true;
                    break;
            }
        }

        public bool GetValue(string key, out string value)
        {
            if (!_fetched || !ConfigManager.appConfig.HasKey(key))
            {
                value = null;
                return false;
            }

            value = ConfigManager.appConfig.GetString(key);
            return true;
        }
    }

Hmm, I tried using your code snippet and I was able to trigger the callback multiple times. Is there a chance somewhere else the event handler is being removed? The other thing that comes to mind is maybe there’s already another request in progress, but if you’re calling it once every ten minutes that seems extremely unlikely.

If neither of those seem plausible, maybe we can hop on a call and do a deep dive on the issue you’re seeing if you’d be open to it.