Search Unity

Banner Ad (even test ads) don't load in Android

Discussion in 'Unity Ads & User Acquisition' started by ZEBEDEE_ENGINEERING, Feb 6, 2021.

  1. ZEBEDEE_ENGINEERING

    ZEBEDEE_ENGINEERING

    Joined:
    Dec 26, 2019
    Posts:
    10
    Hi I have the simple banner ad attached below

    Code (CSharp):
    1. public class BannerAdScript : MonoBehaviour
    2. {
    3.  
    4.  
    5.     public string placementId = "bannerAd";
    6.  
    7.  
    8.     void Start()
    9.     {
    10.         // Initialize the SDK if you haven't already done so:
    11.         Advertisement.Initialize(AppConstants.GAME_ID, MasterController.Instance.TestAds());
    12.  
    13.         StartCoroutine(ShowBannerWhenReady());
    14.         Debug.Log("loading banner ad");
    15.  
    16.  
    17.     }
    18.  
    19.     IEnumerator ShowBannerWhenReady()
    20.     {
    21.         while (!Advertisement.IsReady(placementId))
    22.         {
    23.             yield return new WaitForSeconds(0.5f);
    24.         }
    25.  
    26.         Advertisement.Banner.SetPosition(BannerPosition.TOP_RIGHT);
    27.         Advertisement.Banner.Show(placementId);
    28.     }
    29. }
    However ads do not show, even test ads, I checked the game id and placement id is correct but nothing is loaded, the ad never becomes ready

    Am I missing something here? My app is landscape, should it matter?

    Thanks
     
  2. kyle-unity

    kyle-unity

    Unity Technologies

    Joined:
    Jan 6, 2020
    Posts:
    336
  3. Maximo123213

    Maximo123213

    Joined:
    Dec 12, 2018
    Posts:
    6
  4. ZEBEDEE_ENGINEERING

    ZEBEDEE_ENGINEERING

    Joined:
    Dec 26, 2019
    Posts:
    10
    Yes I did, it was caused by the ad initiating script being included in a gameobject that was instantiated at runtime via prefab, once I added the ad script to a gameobject that was present before runtime it worked fine