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

Remote Config doesn't work on devices

Discussion in 'Unity Remote Config' started by islamagdy111, Jun 26, 2021.

  1. islamagdy111

    islamagdy111

    Joined:
    Oct 29, 2019
    Posts:
    7
    Hey,

    I'm using unity 2020.3.12f1
    I'm trying Remote Config for the first time. I added Setting, Campaign and made my script and everything working just fine on unity editor. but on devices nothing had changed at all !!!
    here is my script:

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using Unity.RemoteConfig;
    5.  
    6. public class EidAdhaManager : MonoBehaviour
    7. {
    8.     public struct userAttributes { }
    9.     public struct appAttributes { }
    10.  
    11.     public bool isEidAdha = false;
    12.  
    13.     public GameObject eidAdhaEvent;
    14.  
    15.     public GameObject eidAdhaBackground;
    16.     public GameObject defaultBackground;
    17.  
    18.     public GameObject eidAdhaSlidePuzzleText;
    19.     public GameObject defaultSlidePuzzleText;
    20.  
    21.     private void Awake()
    22.     {
    23.         ConfigManager.FetchCompleted += ApplyRemoteSettings;
    24.         ConfigManager.FetchConfigs<userAttributes, appAttributes>(new userAttributes(), new appAttributes());
    25.     }
    26.  
    27.     void ApplyRemoteSettings(ConfigResponse response)
    28.     {
    29.         isEidAdha = ConfigManager.appConfig.GetBool("isEidAdha");
    30.  
    31.         if (isEidAdha == true)
    32.         {
    33.             SetupEidAdha();
    34.         }
    35.         else
    36.         {
    37.             SetupDefault();
    38.         }
    39.            
    40.     }
    41.  
    42.     void SetupEidAdha()
    43.     {
    44.         eidAdhaEvent.SetActive(true);
    45.  
    46.         eidAdhaBackground.SetActive(true);
    47.         defaultBackground.SetActive(false);
    48.  
    49.         eidAdhaSlidePuzzleText.SetActive(true);
    50.         defaultSlidePuzzleText.SetActive(false);
    51.     }
    52.  
    53.     void SetupDefault()
    54.     {
    55.         eidAdhaEvent.SetActive(false);
    56.  
    57.         eidAdhaBackground.SetActive(false);
    58.         defaultBackground.SetActive(true);
    59.  
    60.         eidAdhaSlidePuzzleText.SetActive(false);
    61.         defaultSlidePuzzleText.SetActive(true);
    62.     }
    63.  
    64.     void OnDestroy()
    65.     {
    66.         ConfigManager.FetchCompleted -= ApplyRemoteSettings;
    67.     }
    68. }
    69.  


    any idea what's wrong???
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,403
    How are you debugging on the device? (not just examining behavior). You'll want to Debug.Log your variable values at runtime, they will show in the device logs via adb logcat. You can also debug from Visual Studio. I'm not familiar with your code, you would want to get the example code working first without any of your code, then customize after you have the basics working https://docs.unity3d.com/Packages/com.unity.remote-config@2.0/manual/CodeIntegration.html and https://forum.unity.com/threads/tips-for-new-unity-users.701864/#post-5057741 and https://forum.unity.com/threads/how-to-capturing-device-logs-on-android.528680/
     
  3. islamagdy111

    islamagdy111

    Joined:
    Oct 29, 2019
    Posts:
    7
    Solved...
    seems that I should publish a release first (or Testing release) to save Remote Config updates on it.
    so it doesn't work on any previous releases.
     
    JeffDUnity3D likes this.
unityunity