Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice
  2. Welcome to the Unity Forums! Please take the time to read our Code of Conduct here to familiarize yourself with the rules and how to post constructively.

Help Wanted Environment doesn't change

Discussion in 'Unity Remote Config' started by Keraberas, Jun 23, 2021.

  1. Keraberas

    Keraberas

    Joined:
    Jul 7, 2014
    Posts:
    4
    Hello. Our problem is that when the Remote Config environment changes in any form, the data received from the ConfigManager does not change. We do not forget to save the project at the same time, with the Pull command in the Remote Config window, the correct data really comes. But when the application starts, the ConfigManager still returns the same data from the same environment. We observe the same behavior on the application on Android devices. True, there always comes data from another environment. When we commit to git, we see changes to the entityId parameters in the RemoteConfigDataStoreAsset.asset file. There are no rules in all environments.
     
  2. Keraberas

    Keraberas

    Joined:
    Jul 7, 2014
    Posts:
    4
    We do not change the environmentID in the code.
    public ConfigHolder(ILocalDataWriter localDataWriter)
    {
    _localDataWriter = localDataWriter;
    UserId = DeviceId.GetId();
    // Set the user’s unique ID:
    ConfigManager.SetCustomUserID(UserId);
    // Add a listener to apply settings when successfully retrieved:
    ConfigManager.FetchCompleted += ApplyRemoteSettings;
    // Fetch configuration setting from the remote service:
    ConfigManager.FetchConfigs(new UserAttributes(), new AppAttributes());
    }

    private void ApplyRemoteSettings(ConfigResponse configResponse)
    {
    if (configResponse.status == ConfigRequestStatus.Success)
    UpdateConfigs();
    else
    Debug.LogWarning("Remote config : " + configResponse.status);
    }

    private void UpdateConfigs()
    {
    var riddleTvSettings = Parse<RiddleTvSettings>(Const.RiddleTvSettings);
    }

    private T Parse<T>(string key)
    {
    var json = ConfigManager.appConfig.GetString(key);
    var result = JsonUtility.FromJson<T>(json);
    return result;
    }
     
  3. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    12,242
  4. Keraberas

    Keraberas

    Joined:
    Jul 7, 2014
    Posts:
    4
    Thanks for the answer. It turned out that there is a newer version for Remote Config: 2.0.1. We used version 1.0.9 in which there was no SetEnvironmentID method in ConfigManager. Previously, when saving a project, the current environment set in the Remote Config window was changed. Now the behavior of this service has already changed and it always loads the environment data that is installed by default in version 1.0.9. We have updated the project to version 2.0.1 and now we can manually set the EnvironmentID we need.
     
    tagh and JeffDUnity3D like this.
unityunity