Unity: Simple example of integrating the Interstitial adv into your game (Part 4/4)

integrating the Interstitial adv, admob adsense into your game

· 1 min read
Unity: Simple example of integrating the Interstitial adv into your game (Part 4/4)

For the prerequisite steps, such as how to install Unity Advertisement package and integrated into project, please have a look at this:

Unity: Integrate the Advertisement package and monetize your game (Part 1/4)
Install the Advertisement package and setup environment‌There are few things needed before integration, and first of all you need toinstall the Unity Advertisement package: Step 1: Install Unity Advertisement package:Till now, the latest version is 3.4.7, you can use newer version if you like. …

Interstitial adv is a full screen ad,  it can be displayed between loading different game levels, game finished and etc. In this case, we want to show the Interstitial ad when the level starts, so first to create a empty game object named InterstitialAdManager and them attach the following script to it:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Advertisements;

public class InterstitialAdManager : MonoBehaviour {

    #if UNITY_IOS
    private string gameId = "3685328";
    #elif UNITY_ANDROID
    private string gameId = "3685329";
    #endif

    public string placementId = "video";
    public bool testMode = true;

    void Start() {

        // Initialize the Ads service:
        Advertisement.Initialize(gameId, testMode);

        // Show an ad:
        StartCoroutine(ShowInterstitialAdWhenReady());
    }

    IEnumerator ShowInterstitialAdWhenReady () {
        while (!Advertisement.IsReady (placementId)) {
            yield return new WaitForSeconds (0.5f);
        }
        Advertisement.Show();
    }
}

What is the next from here?