Search code examples
unity-game-engineadmobbannerbanner-ads

Unity Admob banner suddenly becomes bigger with video on its bottom


recently I have decided to ad google admob banners to the game. I have followed every step by the guide and added our ad-unit-id too. So everything is ok and cool, but suddenly the banner becomes larger and is showing video at about thrice (or even bigger) the size of the banner itself.

I'm using unity 2020.1.13 and I have tested different banner sizes as admob guide suggesting (SmartBanner, AdaptiveBanner, (default small) Banner ,... ) everything. but it keeps punching me in the face each time. The following images are the normal size(which I expect it to remain) and the larger version that happens 2-3 times out of 10.

Normal size After loaded video size
Normal Size (expected to remain like this) Bigger size wit video

The code requesting the banner is:

    public void RequestBanner(string unitID)
{
    

    // Clean up banner ad before creating a new one.
    if (this.bannerViewAd != null)
    {
        Debug.Log("|||| Prev Banner removed!");
        this.bannerViewAd.Destroy();
    }
    
    AdSize adaptiveSize =
        AdSize.GetPortraitAnchoredAdaptiveBannerAdSizeWithWidth(AdSize.FullWidth);
    
    
    // Create a 320x50 banner at the top of the screen.
    this.bannerViewAd = new BannerView(unitID, adaptiveSize, AdPosition.Bottom);
    
    // Called when an ad request has successfully loaded.
    this.bannerViewAd.OnAdLoaded += this.HandleOnAdLoaded;
    // Called when an ad request failed to load.
    this.bannerViewAd.OnAdFailedToLoad += this.HandleOnAdFailedToLoad;
    // Called when an ad is clicked.
    this.bannerViewAd.OnAdOpening += this.HandleOnAdOpened;
    // Called when the user returned from the app after an ad click.
    this.bannerViewAd.OnAdClosed += this.HandleOnAdClosed;
    // Called when the ad click caused the user to leave the application.
    this.bannerViewAd.OnAdLeavingApplication += this.HandleOnAdLeavingApplication;
    
    // Create an empty ad request.
    AdRequest adRequest = new AdRequest.Builder().Build();
    
    // Load the banner with the request.
    this.bannerViewAd.LoadAd(adRequest);
}

in the code u are seeing adaptivesize and constantSize , I tested both and came up with the same result, also I tested smart banner and same result too.


Solution

  • Until now I could not find any solution for this, even after contacting admob support they refused to answer me.

    So for you guys using admob banner ads, seems like you mustn't use video banner