Showing Admob Interstitial Ad - after Splash Screen

As the title says i want to add an
Interstitial ad after the splash screen on unity using the admob unitypackage provided from google in github
i’m not that great on coding i managed to ad the banner in the main app bottom , some help would be nice
Thanks a lot

You’re more likely to get help if you specify what you’ve tried that isn’t working, paste your code here using code tags, etc, so people can take a look at what it going wrong and help.

You’re unlikely to get help if you haven’t even tried and are just asking for people to write your code for you, which I doubt is the case but your post reads like that though.

1 Like

@Joe-Censored
it’s not like i’m a so lazy to write the code , i’m just very new to unity in general it’s been only 20 days since i installed unity , and i have absolutely no coding experience i managed to learn C# basics in 3 days just to be able to read and understand what i’m looking at , that’s the first thing !
the second, is that i managed to ad a banner by importing the google plugin available on gihub : Releases · googleads/googleads-mobile-unity · GitHub

By Importing the package and creating a new empty game object : and using that code attached to it

using GoogleMobileAds.Api;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AdScript : MonoBehaviour {

    // Use this for initialization
    void Start () {

        showBannerAd();
       
    }

    private void showBannerAd()
    {
        string adID = "ca-app-pub-3940256099942544/6300978111";

        //***For Testing in the Device***
        AdRequest request = new AdRequest.Builder()
       .AddTestDevice(AdRequest.TestDeviceSimulator)       // Simulator.
       .AddTestDevice("2077ef9a63d2b398840261c8221a0c9b")  // My test device.
       .Build();

        //***For Production When Submit App***
        //AdRequest request = new AdRequest.Builder().Build();

        BannerView bannerAd = new BannerView(adID, AdSize.SmartBanner, AdPosition.Top);
        bannerAd.LoadAd(request);
    }

    // Update is called once per frame
    void Update () {
       
    }

it worked fine !

but as i said i was not able to create an interstitial ad to show up after the splash screen because i have no coding experience that’s why i came here seeking for help i may not have provided many details in the topic that’s because it was very late at night and i was so tired , Sorry for that , and i do hope some good–hearted Coder give some help to a poor fellow make his living instead of working as wage slave …

here is the script i found for the interstitial ad but i guess its coded to be shown after the “game over screen”

using UnityEngine;
using System.Collections;
using GoogleMobileAds.Api;

public class AdScript : MonoBehaviour
{

    bool hasShownAdOneTime;

    // Use this for initialization
    void Start()
    {
        //Request Ad
        RequestInterstitialAds();
    }

    void Update()
    {
        if (GameScript.isGameOver)
        {
            if (!hasShownAdOneTime)
            {
                hasShownAdOneTime = true;
                Invoke("showInterstitialAd", 3.0f);
            }
        }
    }

    public void showInterstitialAd()
    {
        //Show Ad
        if (interstitial.IsLoaded())
        {
            interstitial.Show();

            //Stop Sound
            //

            Debug.Log("SHOW AD XXX");
        }

    }

    InterstitialAd interstitial;
    private void RequestInterstitialAds()
    {
        string adID = "ca-app-pub-3940256099942544/1033173712";

#if UNITY_ANDROID
        string adUnitId = adID;
#elif UNITY_IOS
        string adUnitId = adID;
#else
        string adUnitId = adID;
#endif

        // Initialize an InterstitialAd.
        interstitial = new InterstitialAd(adUnitId);

        //***Test***
        AdRequest request = new AdRequest.Builder()
       .AddTestDevice(AdRequest.TestDeviceSimulator)       // Simulator.
       .AddTestDevice("2077ef9a63d2b398840261c8221a0c9b")  // My test device.
       .Build();

        //***Production***
        //AdRequest request = new AdRequest.Builder().Build();

        //Register Ad Close Event
        interstitial.OnAdClosed += Interstitial_OnAdClosed;

        // Load the interstitial with the request.
        interstitial.LoadAd(request);

        Debug.Log("AD LOADED XXX");

    }

    //Ad Close Event
    private void Interstitial_OnAdClosed(object sender, System.EventArgs e)
    {
        //Resume Play Sound

    }
}

If someone could tweak it to work after the unity loading screen i’l be glad , or if it’s not possible a request for an interstitial when the event ( OnButtonClick(); ) would be helpful also ! i really have no coding skills i wish i had … but everything comes with time , one day i’l be great , and i’l help any one seeking for any kind of help !

Of course its possible. You have all of the code right there. Just move the part where it shows the ad ‘showInterstitialAd()’ into an Awake method of a script on your main menu.