Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Question Unity remote config help

Discussion in 'Unity Remote Config' started by jabarir155, Oct 30, 2020.

  1. jabarir155

    jabarir155

    Joined:
    Aug 15, 2020
    Posts:
    3
    I'm currently trying to use unity remote config to change some text but its not working. Every time I hit the play button, the text disappears and the remote config string text doesn't show up.
    Code:
    Code (CSharp):
    1.  
    2.     public Text NewText;
    3.  
    4.     public struct userAttributes { }
    5.     public struct appAttributes { }
    6.    
    7.     void Awake()
    8.     {
    9.         ConfigManager.FetchCompleted += SetText;
    10.         ConfigManager.FetchConfigs<userAttributes, appAttributes>(new userAttributes(), new appAttributes());
    11.     }
    12.  
    13.     // Is called on awake
    14.     void Update()
    15.     {
    16.         ConfigManager.FetchConfigs<userAttributes, appAttributes>(new userAttributes(), new appAttributes());
    17.     }
    18.  
    19.     void SetText(ConfigResponse response)
    20.     {
    21.         NewText.text = ConfigManager.appConfig.GetString("NewsForLauncher");
    22.     }
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Welcome to the Unity Forums! So you know, you generally should not place code like that in Update, it will get called perhaps more than 60 times a second. You only need it once. Please use the example code from the documentation, get it working, then add your customization. https://docs.unity3d.com/Packages/com.unity.remote-config@1.2/manual/CodeIntegration.html
     
    jabarir155 likes this.
  3. jabarir155

    jabarir155

    Joined:
    Aug 15, 2020
    Posts:
    3