Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

[Solved] Remote Settings always returning zero

Discussion in 'Unity Analytics' started by acr1378, Jun 20, 2018.

Thread Status:
Not open for further replies.
  1. acr1378


    Dec 4, 2014
    I just started using remote settings in my project. As far as I can tell I have everything set up properly, but the the Remote Settings GetInt calls always return 0 (or the default values if I specify them). I'm using remote settings from code, not from the editor.

    The project does seem to have a connection with the Remote Settings server as I am able to refresh the values in the Remote Settings window and they do give the correct values as defined in the Dashboard (see attached).

    Here are my Remote Settings Handlers:

    Code (CSharp):
    1.     void HandleRemoteUpdate()
    2.     {
    3.         int maxAdFrequencyInSeconds  = RemoteSettings.GetInt("maxAdFrequencyInSeconds", Default_maxAdFrequencyInSeconds);
    4.         int idleThresholdInSeconds   = RemoteSettings.GetInt("idleThresholdInSeconds", Default_idleThresholdInSeconds);
    5.         int noAdsBufferTimeInSeconds = RemoteSettings.GetInt("noAdsBufferTimeInSeconds", Default_noAdsBufferTimeInSeconds);
    6.         promptedAdInterval = RemoteSettings.GetInt("promptedAdIntervalInSeconds", Default_promptedAdInterval);
    8.         maxAdFrequency  = new TimeSpan(0,0,maxAdFrequencyInSeconds);
    9.         idleThreshold   = new TimeSpan(0,0,idleThresholdInSeconds);
    10.         noAdsBufferTime = new TimeSpan(0,0,noAdsBufferTimeInSeconds);
    12.         Debug.Log(String.Format("maxAdFrequencyInSeconds = {0} || idleThresholdInSeconds = {1} || noAdsBufferTimeInSeconds = {2} || promptedAdInterval = {3}"
    13.                                 , maxAdFrequencyInSeconds, idleThresholdInSeconds, noAdsBufferTimeInSeconds, promptedAdInterval));
    14.     }
    17.     void RemoteSettingsUpdateCompleted(bool wasUpdatedFromServer, bool settingsChanged, int serverResponse)
    18.     {
    19.         Debug.Log(String.Format("wasUpdatedFromServer = {0} || settingsChanged = {1} || serverResponse = {2}", wasUpdatedFromServer,settingsChanged ,serverResponse));
    20.         DebugCall();
    21.     }
    When UpdateCompleted is first called , the values returned are:
    wasUpdatedFromServer = False || settingsChanged = False || serverResponse = -1

    In subsequent calls I get:
    wasUpdatedFromServer = True || settingsChanged = True || serverResponse = 200

    RemoteSettings.Updated is only called once at the start of the game with the wrong values, and is never called again, even when I call ForceUpdate().

    Can anyone help?

    Attached Files:

  2. ap-unity


    Unity Technologies

    Aug 3, 2016

    Your screenshot shows the Release configuration, but the Editor will only pull the values from the Development configuration.

    Can you confirm that the keys and values are also in the Development config?
  3. acr1378


    Dec 4, 2014
    Ah ok. The keys were in the release configuration. I found out after I posted this that everything worked just fine when I built to my iPad.
Thread Status:
Not open for further replies.