Search Unity

Question Is passing game id required for mediation to work?

Discussion in 'Unity Mediation' started by vagelis199, Nov 29, 2022.

  1. vagelis199

    vagelis199

    Joined:
    Jul 27, 2012
    Posts:
    182
    I'm using a custom-made version of the example code for mediation
    Code (CSharp):
    1.  async void InitStartAds()
    2.     {
    3.         try
    4.         {
    5.             Debug.Log("Initializing...");
    6.               Status = "Initializing...";
    7.             await UnityServices.InitializeAsync(GetGameId());
    8.             Debug.Log("Initialized!");
    9.         Status = "Initialized!";
    10.    
    11.             InitializationComplete();
    12.         Ads_St = true;
    13.         }
    14.         catch (Exception e)
    15.         {
    16.             InitializationFailed(e);
    17.            
    18.         }
    19.  
    20.  
    21.     }
    22.  
    23.     InitializationOptions GetGameId()
    24.     {
    25.         var initializationOptions = new InitializationOptions();
    26.  
    27. #if UNITY_IOS
    28.             if (!string.IsNullOrEmpty(iosGameId))
    29.             {
    30.                 initializationOptions.SetGameId(iosGameId);
    31.             }
    32. #elif UNITY_ANDROID
    33.         if (!string.IsNullOrEmpty(androidGameId))
    34.         {
    35.             initializationOptions.SetGameId(androidGameId);
    36.         }
    37. #endif
    38.         return initializationOptions;
    39.     }
    I'm not passing anything for "androidGameId" but everything works like intended, which puzzles me if the passing game id is actually required.
     
  2. vagelis199

    vagelis199

    Joined:
    Jul 27, 2012
    Posts:
    182
    Last edited: Aug 30, 2023