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:
using UnityEngine;
using UnityEngine.SceneManagement;
using Unity.RemoteConfig;
using System.Collections;
using System;
using System.Collections.Generic;
public class RemoteConfigManager : MonoBehaviour
{
public static RemoteConfigManager instance;
public struct userAttributes
{
// Optionally declare variables for any custom user attributes; if none keep an empty struct:
}
[System.Serializable]
public struct appAttributes
{
// Optionally declare variables for any custom app attributes; if none keep an empty struct:
public int level;
public int difficulty; //0 = Normal 1 = Hard 2 = insane
public int wUnlock;
}
// Declare any Settings variables you’ll want to configure remotely:
public float enemyDamageFactor;
[Header("Level1")]
public float RandomL1_Option1;
public float RandomL1_Option2;
public float RandomL1_Option3;
public float RandomL1_Option4;
void Awake()
{
if (instance == null)
{
instance = this;
DontDestroyOnLoad(gameObject);
}
else
{
Destroy(gameObject);
}
}
private void Start()
{
ConfigManager.FetchCompleted += ApplyRemoteSettings;
ConfigManager.FetchConfigs<userAttributes, appAttributes>(new userAttributes(), new appAttributes());
}
private bool ChangeSystem = false;
public void GetRemoteConfigData()
{
ChangeSystem = true;
}
void ApplyRemoteSettings(ConfigResponse configResponse)
{
enemyDamageFactor = ConfigManager.appConfig.GetFloat("EnemyDamage");
RandomL1_Option1 = ConfigManager.appConfig.GetFloat("RandomL1_Option1");
RandomL1_Option2 = ConfigManager.appConfig.GetFloat("RandomL1_Option2");
RandomL1_Option3 = ConfigManager.appConfig.GetFloat("RandomL1_Option3");
RandomL1_Option4 = ConfigManager.appConfig.GetFloat("RandomL1_Option4");
}
}