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 ad does not appear

Discussion in 'Unity Ads & User Acquisition' started by Gabrihellbarbosa, Dec 6, 2019.

  1. Gabrihellbarbosa

    Gabrihellbarbosa

    Joined:
    Jan 6, 2015
    Posts:
    5
    Hello everyone.
    I am developing a test game for a course I am going to teach and I am having trouble with Unity banner advertising.
    The test banner works normally on both Unity and mobile. However, outside of test mode, the banner does not appear. Video ads work normally. From what I researched, there may be no advertising available for display, but I would like to confirm this reason to pass on to my students. I am from Brazil, and I believe that perhaps the region should influence the display of advertisements.
     
  2. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @Gabrihellbarbosa

    You can use the OnBannerError to understand the reason why a banner did not show.

    Here is an example that attempts to load a banner. If successful, it will be shown. If not, the error message is logged.

    Code (CSharp):
    1. string placement = "banner";
    2.  
    3. public void LoadBanner()
    4. {
    5.     if(!Advertisement.Banner.isLoaded)
    6.     {
    7.         BannerLoadOptions loadOptions = new BannerLoadOptions
    8.         {
    9.             loadCallback = OnBannerLoaded,
    10.             errorCallback = OnBannerError
    11.         };
    12.         Advertisement.Banner.Load(placement, loadOptions);
    13.     }
    14. }
    15. void OnBannerLoaded()
    16. {
    17.     Debug.Log("Banner Loaded");
    18.     Advertisement.Banner.Show(placement);
    19. }
    20. void OnBannerError(string error)
    21. {
    22.     Debug.Log("Banner Error: " + error);
    23. }
     
  3. Gabrihellbarbosa

    Gabrihellbarbosa

    Joined:
    Jan 6, 2015
    Posts:
    5
    Thanks for the answer!