Version: 5.6
Removed

ADInterstitialAd

class in UnityEngine.iOS

マニュアルに切り替える
Obsolete

説明

Apple iAD フレームワークの ADInterstitialAd クラスのラッパーです。iPad のみ利用可能です。

iPad アプリケーションがユーザーに表示できるフルスクリーン広告を提供します。

using UnityEngine;
using System.Collections;

using ADInterstitialAd = UnityEngine.iOS.ADInterstitialAd;

public class NewBehaviourScript : MonoBehaviour { private ADInterstitialAd fullscreenAd = null;

void Start() { fullscreenAd = new ADInterstitialAd(); ADInterstitialAd.onInterstitialWasLoaded += OnFullscreenLoaded; ADInterstitialAd.onInterstitialWasViewed += OnFullscreenViewed; }

void WantToShowAD() { if (fullscreenAd.loaded) fullscreenAd.Show(); else fullscreenAd.ReloadAd(); }

void OnFullscreenLoaded() { // you can show ad right here, or, for example, you can start preparing your UI Debug.Log("AD Loaded\n"); }

void OnFullscreenViewed() { // If we reach this stage, it means the user viewed the Ad past the initial screen. // This could be a good point to reward the user (eg. give an in-game bonus item). // You can also start reloading the Ad here if you are not using built-in auto reloading. Debug.Log("AD Viewed\n"); fullscreenAd.ReloadAd(); }

void OnGUI() { if (GUI.Button(new Rect(20, 20, 200, 200), "AD")) WantToShowAD(); } }

このクラスが iOS ネイティブ iAD クラスのラッパーです。そのため、そのインスタンスを頻繁に作成/消去するときには気を付ける必要があります。頻繁に広告を表示する必要がある場合は、絶えずオブジェクトの消去と再作成を繰り返すかわりに、手動で ReloadAd を呼び出すか、自動で再読み込みする ADInterstitialAd を作成してください。

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961