Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Loading Remot Config on start of app

Discussion in 'Unity Remote Config' started by czerwo, Feb 20, 2021.

  1. czerwo

    czerwo

    Joined:
    Jan 4, 2020
    Posts:
    7
    Is there any code example to use in case of loading remote config on start of an app, i see many cases when somebody want to load it but have this issue that it was load from second load of app here is my code :
    Code (CSharp):
    1. protected override void Awake()
    2.         {
    3.             ConfigManager.FetchCompleted += AppServerVersion;
    4.             ConfigManager.FetchConfigs<userAttributes, appAttributes>
    5.                      (new userAttributes(), new appAttributes());
    6.         }
    7. private void AppServerVersion(ConfigResponse reponse)
    8.         {
    9.             serverAppVersion = ConfigManager.appConfig.GetString("Version");
    10.         }
    If you have any example how to load this on first run let me know :)
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Your code is correct. Awake() should fire first, then Start() when your game loads. I would suggest that you place Debug.Log statements to confirm https://forum.unity.com/threads/tips-for-new-unity-users.701864/#post-5057741