Search Unity

Bug Update admob to 7.4.1 No Prefab found in InterstitialAd.Load

Discussion in 'Unity Ads & User Acquisition' started by lezzbiic, Mar 15, 2023.

?

When I call the InterstitialAd.Load function, it displays 'No Prefab found.' Can someone advise me o

  1. lukes90@seznam.cz

    1 vote(s)
    33.3%
  2. lukeshry@gmail.com

    2 vote(s)
    66.7%
  1. lezzbiic

    lezzbiic

    Joined:
    Jun 11, 2022
    Posts:
    2
    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using GoogleMobileAds.Api;
    4.  
    5. public class AdIns : MonoBehaviour
    6. {
    7.     private BannerView bannerView;
    8.     private InterstitialAd interstitial;
    9.     private string adUnitId;
    10.     [System.Obsolete]
    11.     private void Awake()
    12.     {
    13.        
    14.  
    15.         MobileAds.Initialize((InitializationStatus initStatus) =>
    16.         {
    17.             RequestInterstitial();
    18.         });
    19.     }
    20.  
    21.     void Start()
    22.     {
    23.         // Initialize the Google Mobile Ads SDK.
    24.  
    25.  
    26.     }
    27.  
    28.     private void RequestInterstitial()
    29.     {
    30.         adUnitId = "ca-app-pub-2771443006207374/3192777923"; // test id
    31.  
    32.         // Clean up interstitial before using it
    33.         if (interstitial != null)
    34.         {
    35.             interstitial.Destroy();
    36.         }
    37.  
    38.         AdRequest request = new AdRequest.Builder().Build();
    39.         InterstitialAd.Load(adUnitId, request, (InterstitialAd ads, LoadAdError loadAdError) =>
    40.         {
    41.             if (loadAdError != null)
    42.             {
    43.                 return;
    44.             }
    45.             else
    46.             if (ads == null)
    47.             {
    48.                 return;
    49.             }
    50.             Debug.Log("Interstitial ad loaded");
    51.             interstitial = ads;
    52.  
    53.         });
    54.     }
    55.  
    56.     public void ShowInterstitialAd()  // Show
    57.     {
    58.         if (interstitial != null && interstitial.CanShowAd())
    59.         {
    60.             interstitial.Show();
    61.         }
    62.     }
    63.  
    64.  
    65. }
    66.  
    67.  
     
  2. Yasuyuki

    Yasuyuki

    Unity Technologies

    Joined:
    Sep 11, 2014
    Posts:
    153
    Hello,

    Did you remove all GMA folders/files before updating? It seems like something corrupted in your project while updating.
    I'd recommend reimporting them all and seeing if your project has the correct prefab files.
     
  3. lezzbiic

    lezzbiic

    Joined:
    Jun 11, 2022
    Posts:
    2
    Thnak you :)
     
  4. adrenal36

    adrenal36

    Joined:
    Jan 20, 2014
    Posts:
    8
    give this man a prize ! Thank you Yasuyuki!
     
  5. Almansyahru

    Almansyahru

    Joined:
    Apr 25, 2021
    Posts:
    1
    Thank You,
     
  6. yatend

    yatend

    Joined:
    Feb 2, 2022
    Posts:
    1
    thankss