Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We are updating our Terms of Service for all Unity subscription plans, effective October 13, 2022, to create a more streamlined, user-friendly set of terms. Please review them here: unity.com/legal/terms-of-service.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

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

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,360
    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
unityunity