Search Unity

Question Setting Environments for UGS and RemoteConfig Without Needing Name and ID

Discussion in 'Unity Remote Config' started by Tomumental, Feb 1, 2022.

  1. Tomumental

    Tomumental

    Joined:
    Nov 2, 2021
    Posts:
    11
    For the general UGS setup I am using the environment name:
    Code (CSharp):
    1. var options = new InitializationOptions();
    2. options.SetEnvironmentName("development");
    3. await UnityServices.InitializeAsync(options);
    But for RemoteConfigs, I they reccomend using the envirnment's ID to initialize:
    Code (CSharp):
    1. ConfigManager.SetEnvironmentID("aaaaaaaa-bbbb-1234-9876-abcd1234abc");
    Is there a way to initialize either of these the opposite way such that I only need to store/modify a single variable an have both point to a new environment?
     
  2. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    282
    Hi Tomumental,

    Thanks for your feedback.
    I will report this to the team and see if there is a way to unify both into one.

    upload_2022-2-1_15-7-47.png

    If the ConfigManager had :
    ConfigManager.SetEnvironmentName("development") would this do the trick?

    OR

    It was brought to my attention that you would like to have the 1 call that would also set the environment for remote config?

    We are looking into this feedback. Thanks again
     
    Last edited: Feb 1, 2022
  3. Tomumental

    Tomumental

    Joined:
    Nov 2, 2021
    Posts:
    11
    Yep
    ConfigManager.SetEnvironmentName("development");
    would be perfect!
     
    SebT_Unity likes this.
  4. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    282
    Hi @Tomumental ,
    As a workaround you can try the following:

    Code (CSharp):
    1. var options = new InitializationOptions().SetOption("com.unity.services.core.environment-name", "dev");
    2. await UnityServices.InitializeAsync(options);
    This would let you set the environment name through the options.

    I have tested this locally with success. Let me know if you have any issues.

    All the best,
    Seb
     
  5. Tomumental

    Tomumental

    Joined:
    Nov 2, 2021
    Posts:
    11
    Thanks that works!
     
    SebT_Unity likes this.