Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Banner ads not loading, even in test mode

Discussion in 'Unity Ads & User Acquisition' started by Phoenix116, Mar 19, 2019.

  1. Phoenix116

    Phoenix116

    Joined:
    Jun 30, 2016
    Posts:
    39
    Everything works fine, I only get 1 error in the logcat "com.unity3d.ads.api.Sdk.logError() (line:58) :: Promo catalog JSON is empty" but I don't think its the problem, every ad is working fine, I'm only having problems with banners

    EDIT: I was using the wrong code, actually the code for using ads is a bit different that the one used in interstitials and rewardeds, for example:
    Code (CSharp):
    1. using System.Collections;
    2. using UnityEngine;
    3. using UnityEngine.Advertisements;
    4.  
    5. public class BannerAds : MonoBehaviour {
    6.  
    7.     public string bannerPlacement = "banner";
    8.     public bool testMode = false;
    9.  
    10. #if UNITY_IOS
    11.     public const string gameID = "1234567";
    12. #elif UNITY_ANDROID
    13.     public const string gameID = "1234568";
    14. #elif UNITY_EDITOR
    15.     public const string gameID = "1111111";
    16. #endif
    17.  
    18.     void Start () {
    19.         Advertisement.Initialize (gameID, testMode);
    20.         StartCoroutine (ShowBannerWhenReady ());
    21.     }
    22.  
    23.     IEnumerator ShowBannerWhenReady () {
    24.         while (!Advertisement.IsReady ("banner")) {
    25.             yield return new WaitForSeconds (0.5f);
    26.         }
    27.         Advertisement.Banner.Show (bannerPlacement);
    28.     }
    29. }
     
    Last edited: Mar 19, 2019