GoogleMobileAdsScript.RequestInterstitial C# (CSharp) Method

RequestInterstitial() public method

public RequestInterstitial ( ) : void
return void
    public void RequestInterstitial()
    {
        if (disableAds)
            return;

        if (interstitial != null)
            interstitial.Destroy ();

        #if UNITY_EDITOR
            string adUnitId = "unused";
        #elif UNITY_ANDROID
        string adUnitId = "ca-app-pub-2481366852569675/6767420744";
        #elif UNITY_IPHONE
            string adUnitId = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE";
        #else
            string adUnitId = "unexpected_platform";
        #endif

            // Create an interstitial.
        interstitial = new InterstitialAd(adUnitId);
        // Register for ad events.
        interstitial.AdLoaded += HandleInterstitialLoaded;
        interstitial.AdFailedToLoad += HandleInterstitialFailedToLoad;
        interstitial.AdOpened += HandleInterstitialOpened;
        interstitial.AdClosing += HandleInterstitialClosing;
        interstitial.AdClosed += HandleInterstitialClosed;
        interstitial.AdLeftApplication += HandleInterstitialLeftApplication;
        GoogleMobileAdsHandler handler = new GoogleMobileAdsHandler();
        interstitial.SetInAppPurchaseHandler(handler);
        // Load an interstitial ad.
        interstitial.LoadAd(createAdRequest());
    }

Usage Example

コード例 #1
0
    // Use this for initialization
    void Start()
    {
        ad = GameObject.FindGameObjectWithTag("Ad").GetComponent <GoogleMobileAdsScript>();
        ad.RequestInterstitial();

        destinationNode             = nodes[size_x - 1, 0];
        destinationNode.isBuildable = false;
        enemySpawnNode             = nodes[0, size_z - 1];
        enemySpawnNode.isBuildable = false;

        MakeGrid();
    }
All Usage Examples Of GoogleMobileAdsScript::RequestInterstitial