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.

Question Remote Settings Updated is returning null exception on Unity's Cloud diagnostics report

Discussion in 'Unity Remote Config' started by GreedyDude, Mar 19, 2021.

  1. GreedyDude

    GreedyDude

    Joined:
    Oct 5, 2020
    Posts:
    8
    Managed Stack Trace:

    AdNetworkManager.RemoteSettingsUpdated () (at <00000000000000000000000000000000>:0)
    UnityEngine.RemoteSettings+UpdatedEventHandler.Invoke () (at <00000000000000000000000000000000>:0)

    This is my code :

    Code (CSharp):
    1.  
    2.  
    3. public GameObject AdmobAdManager; //set using drag and drop inspector
    4. public GameObject UnityManager; //set using drag and drop inspector
    5.  
    6. private void Awake()
    7.     {
    8.         RemoteSettings.Updated += RemoteSettingsUpdated;
    9.         if (!Instance)
    10.         {
    11.             Instance = this;
    12.             DontDestroyOnLoad(gameObject);
    13.         }
    14.         else
    15.         {
    16.             //Duplicate GameManager created every time the scene is loaded
    17.             Destroy(gameObject);
    18.             return;
    19.         }
    20.     }
    21. private bool admobSelected = false;
    22.  
    23. private void RemoteSettingsUpdated()
    24.     {
    25.        
    26.      
    27.         if (RemoteSettings.HasKey(admobSelectedRemoteKey))
    28.             admobSelected = RemoteSettings.GetBool(admobSelectedRemoteKey);
    29.  
    30.         if (admobSelected)
    31.         {
    32.             AdmobAdManager.SetActive(true);
    33.             UnityManager.SetActive(false);
    34.          
    35.         }
    36.         else
    37.         {
    38.             UnityManager.SetActive(true);
    39.             AdmobAdManager.SetActive(false);
    40.          
    41.         }
    42.     }
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    This would be a bug in your code that you would need to debug. Does it reproduce for you locally?