Managed Stack Trace:
AdNetworkManager.RemoteSettingsUpdated () (at <00000000000000000000000000000000>:0)
UnityEngine.RemoteSettings+UpdatedEventHandler.Invoke () (at <00000000000000000000000000000000>:0)
This is my code :
public GameObject AdmobAdManager; //set using drag and drop inspector
public GameObject UnityManager; //set using drag and drop inspector
private void Awake()
{
RemoteSettings.Updated += RemoteSettingsUpdated;
if (!Instance)
{
Instance = this;
DontDestroyOnLoad(gameObject);
}
else
{
//Duplicate GameManager created every time the scene is loaded
Destroy(gameObject);
return;
}
}
private bool admobSelected = false;
private void RemoteSettingsUpdated()
{
if (RemoteSettings.HasKey(admobSelectedRemoteKey))
admobSelected = RemoteSettings.GetBool(admobSelectedRemoteKey);
if (admobSelected)
{
AdmobAdManager.SetActive(true);
UnityManager.SetActive(false);
}
else
{
UnityManager.SetActive(true);
AdmobAdManager.SetActive(false);
}
}