Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Best practices for managing settings with multiple (two) environments?

Discussion in 'Unity Remote Config' started by Bmandk, Mar 8, 2021.

  1. Bmandk

    Bmandk

    Joined:
    Aug 18, 2012
    Posts:
    70
    Hi, just a disclaimer, I'm very new to the remote config package.

    I'm wondering, what is the best practices for managing settings on multiple environments?
    I see a couple options:
    1. Manually making sure that the keys are all present in both environments
    2. Using default values with ConfigManager.appConfig.GetX(key, defaultValue)
    3. Using HasKey and only getting the value if the key is there
    Now obviously 2 and 3 are conceptually similar, so I'll collapse them together. However I'm not sure what the best approach is though. On the one hand, using the first option is tedious, and can seem a bit error prone.

    But the other solution can sort of silently fail, if I expect a key to be there, but I forgot to assign it.

    I think the ideal solution here would be to sort of sync the keys between all environments, perhaps with some default value. This way it feels much less error prone when adding them, and you don't silently fail if a key is missing as well.

    However if that last thing is not possible, what are the best practices here?
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  3. Bmandk

    Bmandk

    Joined:
    Aug 18, 2012
    Posts:
    70
    @JeffDUnity3D Ah, I had missed the copy config option, that seems close enough, thanks!

    I had also considered the REST client, but this project is too small to set that up here. But I'll definitely keep that in mind for the future.
     
    JeffDUnity3D likes this.