Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug AdMob Interstitial is not fit for screen

Discussion in 'Editor & General Support' started by CraftedGaming, Dec 15, 2022.

  1. CraftedGaming

    CraftedGaming

    Joined:
    Jun 9, 2017
    Posts:
    36
    Hi, I just followed the steps found on Interstitial ads | Unity | Google Developers to create an interstitial (full screen) ad.

    This is the code I used:
    Code (CSharp):
    1. InterstitialAd interstitial;
    2. string AndroidId = "ca-app-pub-3940256099942544/8691691433";
    3. string IphoneId;
    4.  
    5. void RequestInterstitial(){
    6.     string adUnitId = string.Empty;
    7.  
    8.     #if UNITY_ANDROID || UNITY_EDITOR
    9.         adUnitId = AndroidId;
    10.     #elif UNITY_IPHONE || UNITY_EDITOR
    11.         adUnitId = IphoneId;
    12.     #endif
    13.  
    14.     // Initialize an InterstitialAd.
    15.     interstitial = new InterstitialAd(adUnitId);
    16.    
    17.     // Called when an ad request has successfully loaded.
    18.     interstitial.OnAdLoaded += OnAdLoaded;
    19.     // Called when an ad request failed to load.
    20.     interstitial.OnAdFailedToLoad += OnAdFailedToLoad;
    21.     // Called when an ad is shown.
    22.     interstitial.OnAdOpening += OnAdOpening;
    23.     // Called when the ad is closed.
    24.     interstitial.OnAdClosed += OnAdClosed;
    25.  
    26.     // Create an empty ad request.
    27.     AdRequest request = new AdRequest.Builder().Build();
    28.     // Load the interstitial with the request.
    29.     interstitial.LoadAd(request);
    30. }
    31.  
    32. // somewhere in the code after loading the ad
    33. interstitial.Show();
    But as you can see in the photo below that the image is not showing properly


    upload_2022-12-15_12-15-26.png

    What did I do wrong? Is there a way to set the size of the ad of an interstitial ad? from what I'm aware, it is supposedly fullscreen
     
  2. Gokul46585

    Gokul46585

    Joined:
    Sep 9, 2022
    Posts:
    6
    i think it is a problem with device orientation settings. go to player settings> android settings> resolution and presentation> orientation settings. check other settings in that too to make sure everything is fine.