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

Remote Config not working

Discussion in 'Unity Remote Config' started by rdgorodrigo, Aug 11, 2020.

  1. rdgorodrigo

    rdgorodrigo

    Joined:
    Mar 20, 2015
    Posts:
    1
    I'm using Unity 2019.3.7 with remote config 1.0.9
    Environment: development
    I'm setting the values from remote config to a scriptable object, when I'm using the editor they are working fine, however when building an apk they are not getting called.

    Code:
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.SceneManagement;
    3. using Unity.RemoteConfig;
    4. using System.Collections;
    5. using System;
    6. using System.Collections.Generic;
    7.  
    8. public class RemoteConfigManager : MonoBehaviour
    9. {
    10.  
    11.  
    12.     public static RemoteConfigManager instance;
    13.  
    14.     public struct userAttributes
    15.     {
    16.         // Optionally declare variables for any custom user attributes; if none keep an empty struct:    
    17.     }
    18.     [System.Serializable]
    19.     public struct appAttributes
    20.     {
    21.         // Optionally declare variables for any custom app attributes; if none keep an empty struct:    
    22.         public int level;
    23.         public int difficulty;   //0 = Normal  1 = Hard   2 = insane
    24.         public int wUnlock;
    25.     }
    26.  
    27.     // Declare any Settings variables you’ll want to configure remotely:
    28.     public float enemyDamageFactor;
    29.     [Header("Level1")]
    30.     public float RandomL1_Option1;
    31.     public float RandomL1_Option2;
    32.     public float RandomL1_Option3;
    33.     public float RandomL1_Option4;
    34.    
    35.     void Awake()
    36.     {
    37.         if (instance == null)
    38.         {
    39.             instance = this;
    40.             DontDestroyOnLoad(gameObject);
    41.         }
    42.         else
    43.         {
    44.             Destroy(gameObject);
    45.         }
    46.     }
    47.  
    48.     private void Start()
    49.     {
    50.         ConfigManager.FetchCompleted += ApplyRemoteSettings;
    51.         ConfigManager.FetchConfigs<userAttributes, appAttributes>(new userAttributes(), new appAttributes());
    52.     }
    53.  
    54.     private bool ChangeSystem = false;
    55.     public void GetRemoteConfigData()
    56.     {
    57.         ChangeSystem = true;
    58.     }
    59.  
    60.     void ApplyRemoteSettings(ConfigResponse configResponse)
    61.     {
    62.         enemyDamageFactor = ConfigManager.appConfig.GetFloat("EnemyDamage");
    63.  
    64.         RandomL1_Option1 = ConfigManager.appConfig.GetFloat("RandomL1_Option1");
    65.         RandomL1_Option2 = ConfigManager.appConfig.GetFloat("RandomL1_Option2");
    66.         RandomL1_Option3 = ConfigManager.appConfig.GetFloat("RandomL1_Option3");
    67.         RandomL1_Option4 = ConfigManager.appConfig.GetFloat("RandomL1_Option4");
    68.  
    69.        
    70.     }
    71. }
    72.  
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    12,159
    Can you please add Debug.Log statements and print out the values of your variables at runtime. They will show in the device logs. Also, there was an issue in the version of RC that you are using with floats returning 0. Please show Preview Packages under Advanced in Package Manager and install the latest package and test. https://forum.unity.com/threads/how-to-capturing-device-logs-on-android.528680/ or use the Asset store logcat package https://forum.unity.com/threads/android-logcat-package-feedback.595003/ and https://forum.unity.com/threads/tips-for-new-unity-users.701864/#post-5057741
     
unityunity