Search Unity

  1. We've closed the job boards. If you're looking for work, or looking to hire check out Unity Connect. You can see more information here.
    Dismiss Notice
  2. Unity 2017.2 is now released.
    Dismiss Notice
  3. The Unity Gear Store is here to help you look great at your next meetup, user group or conference. With all new Unity apparel, stickers and more!
    Dismiss Notice
  4. If you're a macOS 10.13 High Sierra user take be sure to read this before updating Unity.
    Dismiss Notice
  5. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  7. Unity 2017.3 beta is now available for download.
    Dismiss Notice

Remote settings takes two loads to update

Discussion in 'Unity Analytics' started by Brathnann, Nov 13, 2017.

  1. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    2,880
    Currently, using remote settings for version control and to be able to let a user know if there is an update.

    However, I seem to be getting some odd behavior.

    If I currently, for example, have a string with version 1.0.0 listed in it up on the remote server and start up the game, it shows 1.0.0 as the value as expected.

    If I then change it to 1.0.1 for example and load up the game, it still shows 1.0.0. If I restart the game, it will then show 1.0.1 like it should.

    I do have
    RemoteSettings.Updated += new RemoteSettings.UpdatedEventHandler(HandleRemoteUpdate); in Start and the debugs get printed in the method that gets called, but I'm not sure if it's just using an older remote settings if it seems to take to long? We have a decent internet connection at work, so I wouldn't have thought that we'd have issues with getting the updated RemoteSettings.

    Is there a way to adjust the timeout or get it to wait longer for the remotesettings to get fetched?
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    616
    It might take a few seconds for the server settings to take effect once saved, but is not an issue that we are aware of. Does it always take two restarts of the app to see the new settings, regardless of elapsed time?
     
  3. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    2,880
    Yes, I tried a few test. I changed it and loaded up the app right away and it showed the old version the first time and then the new version the second time. (I actually thought it just needed a moment to update on the server)

    Other test I waited several mins and it still took two loads to update.

    I actually even did a test to see if a fresh load did anything. If I did a fresh load (where I went into android settings and cleared all data). When I debuged RemoteSettings.GetString("iOSVersion") it showed up empty the first time and then the proper version number the second time.

    I'm using Unity 2017.2.0p1 and I use https://assetstore.unity.com/packages/tools/log-viewer-12047 Log viewer to show the debug print outs once built to the android device.
     
  4. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    616
    When you mention "load up the app", you mean you restart the app? The settings only load when you start the app (or restart).
     
  5. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    2,880
    Yes, I completely close the app(swipe it so it closes) and tap the icon to start it up again. We have a startup scene that handles initial setup and where the version check is.
     
  6. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    2,880
    To add, it seems fine in Editor. If I change the Development remote settings and run it in editor, it is getting the new value. Just seems to be once I build to the device and change the Release settings that it takes two app restarts to get the new value.
     
  7. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    616
    Understood, I will test here and confirm.
     
  8. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    2,880
    Any chance you had the opportunity to verify this on your end?

    Thanks.
     
  9. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    616
    @Brathnann I will try to get to this soon, hopefully in the next day or two.
     
  10. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    616
    I was not able to reproduce. I set a Development setting in the Dashboard, and clicked Sync. Each time I do this, and then the next time I run the game in the Editor, it shows the new setting on first play. My Android device is using the Release settings, and it also displays the updated Remote Setting on first play. I'm using Unity 2017.3 and Remote Settings 0.1.6.
     
  11. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    2,880
    hmm...Well, I'm not sure if this is something I could give a build of since you don't have access to my remote settings. We're still in 2017.2.0p1 since 2017.3 is in beta, but I'll do a split and see if it occurs in the latest beta as well.
     
  12. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    616
    Does this occur in the Editor for you as well? I don't believe it is release related, we have not heard of any other reports of this behavior. If you want to direct message me, I could give you a zip file of my project, and you could link it to your organization and create the corresponding remote setting value in your Dashboard.
     
  13. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    2,880
    It doesn't happen in editor, only in the Android build. And it doesn't occur with other versions of Unity as we've used remote settings before without this happening, so this was the first time I'd seen it behave this way, but this is a different project and I just went through setting up remote settings in it.
     
  14. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    616
    Understood, let me test with 2017.2 also.
     
  15. ovrdb

    ovrdb

    Joined:
    Jun 1, 2015
    Posts:
    3
    Same Problem here on iOS. I'm on Unity 5.6, RemoteSettings 0.1.6.

    I'm trying to fetch a boolean from remote settings in the first scene, directly at startup.
    When I run a fresh build via xcode on a device, the boolean has the value it had on compile time when I check it in the OnUpdated handler.

    This is how to reproduce it:
    - compile in unity
    - change the remote settings in the analytics dashboard
    - wait
    - run on device via XCode: settings are not updated
    - close the app
    - rerun: settings are updated

    That behaviour is reproducable, even when not rebuilding the project in between. Every change in the remote settings needs two startups for the app to get it, regardless the wait time.

    Is OnUpdated fired at session start, although the server request is not through, yet?
    I read about "RemoteSettings.ForceUpdate" but that method doesn't seem to exist any more.
     
  16. ovrdb

    ovrdb

    Joined:
    Jun 1, 2015
    Posts:
    3
    Appears to be a race condition issue: when I add a few seconds delay after OnUpdated before getting the RemoteSetting value it works as expected.
     
  17. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    2,880
    I was wondering if that may be the case, that it was perhaps timing out and then triggering the Update call back to use the old values. Mine did start working correctly, but I hadn't retested since I tested again a few days ago. Your results are exactly what I got the first time around when I ran several test.

    Also, the ForceUpdate call still exist for me. It was actually the suggested way to get the values if I needed to retrieve them outside when the app starts.