I’m using Unity 2019.4.0f1 with remote config 1.0.9
Environment: development
I’m setting the values from remote config to a scriptable object.
When my game starts and remote config data fetch is completed all the values are set to zero.
It worked yesterday with the same code. but now not working (both editor and android build
Code:
using UnityEngine;
using Unity.RemoteConfig;
public class RemoteConfigController : MonoBehaviour
{
public static RemoteConfigController currentRemoteConfigController;
public struct userAttributes
{
// Optionally declare variables for any custom user attributes; if none keep an empty struct:
}
public struct appAttributes
{
// Optionally declare variables for any custom app attributes; if none keep an empty struct:
}
// Optionally declare a unique assignmentId if you need it for tracking:
[SerializeField] private GameConfigurationData gameConfigSettingsRemote;
void Awake()
{
if (currentRemoteConfigController != null && currentRemoteConfigController != this)
{
Destroy(currentRemoteConfigController.gameObject);
}
currentRemoteConfigController = this;
DontDestroyOnLoad(currentRemoteConfigController.gameObject);
ConfigManager.FetchCompleted += ApplyRemoteSettings;
//FetchGameConfigData();
}
public void FetchGameConfigData()
{
ConfigManager.FetchConfigs<userAttributes, appAttributes>(new userAttributes(), new appAttributes());
}
void ApplyRemoteSettings(ConfigResponse configResponse)
{
// Conditionally update settings, depending on the response's origin:
switch (configResponse.requestOrigin)
{
case ConfigOrigin.Default:
Debug.Log("No settings loaded this session; using default values.");
break;
case ConfigOrigin.Cached:
Debug.Log("No settings loaded this session; using cached values from a previous session.");
LoadConfigData();
break;
case ConfigOrigin.Remote:
Debug.Log("New settings loaded this session; update values accordingly.");
LoadConfigData();
break;
}
}
void LoadConfigData()
{
gameConfigSettingsRemote.enemySpawnDelayMin = ConfigManager.appConfig.GetFloat("enemySpawnDelayMin");
gameConfigSettingsRemote.enemySpawnDelayMax = ConfigManager.appConfig.GetFloat("enemySpawnDelayMax");
gameConfigSettingsRemote.enemySpawnDistanceMin = ConfigManager.appConfig.GetFloat("enemySpawnDistanceMin");
gameConfigSettingsRemote.enemySpawnDistanceMax = ConfigManager.appConfig.GetFloat("enemySpawnDistanceMax");
gameConfigSettingsRemote.enemyCountLevelStart = ConfigManager.appConfig.GetInt("enemyCountLevelStart");
gameConfigSettingsRemote.enemyCountLevelMax = ConfigManager.appConfig.GetInt("enemyCountLevelMax");
gameConfigSettingsRemote.enemyCountLevelIncrease = ConfigManager.appConfig.GetInt("enemyCountLevelIncrease");
gameConfigSettingsRemote.enemyLifeLevelStart = ConfigManager.appConfig.GetInt("enemyLifeLevelStart");
gameConfigSettingsRemote.enemyLifeLevelMax = ConfigManager.appConfig.GetInt("enemyLifeLevelMax");
gameConfigSettingsRemote.enemyLifeLevelIncrease = ConfigManager.appConfig.GetInt("enemyLifeLevelIncrease");
gameConfigSettingsRemote.enemyLifetimeLevelStart = ConfigManager.appConfig.GetFloat("enemyLifetimeLevelStart");
gameConfigSettingsRemote.enemyLifetimeLevelMax = ConfigManager.appConfig.GetFloat("enemyLifetimeLevelMax");
gameConfigSettingsRemote.enemyLifetimeLevelIncrease = ConfigManager.appConfig.GetFloat("enemyLifetimeLevelIncrease");
gameConfigSettingsRemote.enemySpeedLevelStart = ConfigManager.appConfig.GetFloat("enemySpeedLevelStart");
gameConfigSettingsRemote.enemySpeedLevelMax = ConfigManager.appConfig.GetFloat("enemySpeedLevelMax");
gameConfigSettingsRemote.enemySpeedLevelIncrease = ConfigManager.appConfig.GetFloat("enemySpeedLevelIncrease");
gameConfigSettingsRemote.enemyTurnSpeedLevelStart = ConfigManager.appConfig.GetFloat("enemyTurnSpeedLevelStart");
gameConfigSettingsRemote.enemyTurnSpeedLevelMax = ConfigManager.appConfig.GetFloat("enemyTurnSpeedLevelMax");
gameConfigSettingsRemote.enemyTurnSpeedLevelIncrease = ConfigManager.appConfig.GetFloat("enemyTurnSpeedLevelIncrease");
gameConfigSettingsRemote.enemyDeathVolume = ConfigManager.appConfig.GetFloat("enemyDeathVolume");
gameConfigSettingsRemote.playerSpeed = ConfigManager.appConfig.GetFloat("playerSpeed");
gameConfigSettingsRemote.playerGunLifetime0 = ConfigManager.appConfig.GetFloat("playerGunLifetime0");
gameConfigSettingsRemote.playerGunLifetime1 = ConfigManager.appConfig.GetFloat("playerGunLifetime1");
gameConfigSettingsRemote.playerGunLifetime2 = ConfigManager.appConfig.GetFloat("playerGunLifetime2");
gameConfigSettingsRemote.playerGunDamage0 = ConfigManager.appConfig.GetInt("playerGunDamage0");
gameConfigSettingsRemote.playerGunDamage1 = ConfigManager.appConfig.GetInt("playerGunDamage1");
gameConfigSettingsRemote.playerGunDamage2 = ConfigManager.appConfig.GetInt("playerGunDamage2");
gameConfigSettingsRemote.playerGunReloadtime0 = ConfigManager.appConfig.GetFloat("playerGunReloadtime0");
gameConfigSettingsRemote.playerGunReloadtime1 = ConfigManager.appConfig.GetFloat("playerGunReloadtime1");
gameConfigSettingsRemote.playerGunReloadtime2 = ConfigManager.appConfig.GetFloat("playerGunReloadtime2");
gameConfigSettingsRemote.playerGunRange0 = ConfigManager.appConfig.GetFloat("playerGunRange0");
gameConfigSettingsRemote.playerGunRange1 = ConfigManager.appConfig.GetFloat("playerGunRange1");
gameConfigSettingsRemote.playerGunRange2 = ConfigManager.appConfig.GetFloat("playerGunRange2");
gameConfigSettingsRemote.playerShieldVolume = ConfigManager.appConfig.GetFloat("playerShieldVolume");
gameConfigSettingsRemote.playerAmmoShootVolume = ConfigManager.appConfig.GetFloat("playerAmmoShootVolume");
gameConfigSettingsRemote.playerAmmoHitVolume = ConfigManager.appConfig.GetFloat("playerAmmoHitVolume");
gameConfigSettingsRemote.playerFootstepVolume = ConfigManager.appConfig.GetFloat("playerFootstepVolume");
gameConfigSettingsRemote.playerDeathVolume = ConfigManager.appConfig.GetFloat("playerDeathVolume");
gameConfigSettingsRemote.pickupCountMax = ConfigManager.appConfig.GetInt("pickupCountMax");
gameConfigSettingsRemote.pickupSpawnDelay = ConfigManager.appConfig.GetFloat("pickupSpawnDelay");
gameConfigSettingsRemote.pickupVolume = ConfigManager.appConfig.GetFloat("pickupVolume");
gameConfigSettingsRemote.gameMusicVolume = ConfigManager.appConfig.GetFloat("gameMusicVolume");
gameConfigSettingsRemote.gameSittingPosePercentage = ConfigManager.appConfig.GetInt("gameSittingPosePercentage");
gameConfigSettingsRemote.gameLayingPosePercentage = ConfigManager.appConfig.GetInt("gameLayingPosePercentage");
gameConfigSettingsRemote.gameGroundPosePercentage = ConfigManager.appConfig.GetInt("gameGroundPosePercentage");
gameConfigSettingsRemote.gameLevelChangeDelay = ConfigManager.appConfig.GetFloat("gameLevelChangeDelay");
gameConfigSettingsRemote.gameRewardLevelCount = ConfigManager.appConfig.GetInt("gameRewardLevelCount");
gameConfigSettingsRemote.playerStartingGemsCount = ConfigManager.appConfig.GetInt("playerStartingGemsCount");
gameConfigSettingsRemote.playerGemsLevelStart = ConfigManager.appConfig.GetInt("playerGemsLevelStart");
gameConfigSettingsRemote.playerGemsLevelMax = ConfigManager.appConfig.GetInt("playerGemsLevelMax");
gameConfigSettingsRemote.playerGemsLevelIncrease = ConfigManager.appConfig.GetInt("playerGemsLevelIncrease");
gameConfigSettingsRemote.playerGemPickupLifetime = ConfigManager.appConfig.GetFloat("playerGemPickupLifetime");
gameConfigSettingsRemote.costUpgradeLevel1 = ConfigManager.appConfig.GetInt("costUpgradeLevel1");
gameConfigSettingsRemote.costUpgradeLevel2 = ConfigManager.appConfig.GetInt("costUpgradeLevel2");
gameConfigSettingsRemote.ammoLifetime = ConfigManager.appConfig.GetFloat("ammoLifetime");
gameConfigSettingsRemote.ammoVelocity = ConfigManager.appConfig.GetFloat("ammoVelocity");
gameConfigSettingsRemote.assignmentId = ConfigManager.appConfig.assignmentID;
}
void OnDestroy()
{
ConfigManager.FetchCompleted -= ApplyRemoteSettings;
}
}