Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  4. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  5. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    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

    acr1378

    Joined:
    Dec 4, 2014
    Posts:
    44
    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);
    7.  
    8.         maxAdFrequency  = new TimeSpan(0,0,maxAdFrequencyInSeconds);
    9.         idleThreshold   = new TimeSpan(0,0,idleThresholdInSeconds);
    10.         noAdsBufferTime = new TimeSpan(0,0,noAdsBufferTimeInSeconds);
    11.  
    12.         Debug.Log(String.Format("maxAdFrequencyInSeconds = {0} || idleThresholdInSeconds = {1} || noAdsBufferTimeInSeconds = {2} || promptedAdInterval = {3}"
    13.                                 , maxAdFrequencyInSeconds, idleThresholdInSeconds, noAdsBufferTimeInSeconds, promptedAdInterval));
    14.     }
    15.  
    16.  
    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

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    969
    @acr1378

    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

    acr1378

    Joined:
    Dec 4, 2014
    Posts:
    44
    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.