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

Help Wanted 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:
    12,218
    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