ADBannerView is a wrapper around the ADBannerView class found in the Apple iAd framework and is only available on iOS.
It provides a view that displays banner advertisements to the user.
private var banner : iOS.ADBannerView;
function Start() { banner = new iOS.ADBannerView(iOS.ADBannerView.Type.Banner, iOS.ADBannerView.Layout.Top); iOS.ADBannerView.onBannerWasClicked += OnBannerClicked; iOS.ADBannerView.onBannerWasLoaded += OnBannerLoaded; }
function OnBannerClicked() { Debug.Log("Clicked!\n"); }
function OnBannerLoaded() { Debug.Log("Loaded!\n"); banner.visible = true; }
using UnityEngine; using System.Collections;
using ADBannerView = UnityEngine.iOS.ADBannerView;
public class NewBehaviourScript : MonoBehaviour {
private ADBannerView banner = null; void Start() { banner = new ADBannerView(ADBannerView.Type.Banner, ADBannerView.Layout.Top); ADBannerView.onBannerWasClicked += OnBannerClicked; ADBannerView.onBannerWasLoaded += OnBannerLoaded; }
void OnBannerClicked() { Debug.Log("Clicked!\n"); }
void OnBannerLoaded() { Debug.Log("Loaded!\n"); banner.visible = true; } }
layout | Banner layout. |
loaded | Checks if banner contents are loaded. |
position | The position of the banner view. |
size | The size of the banner view. |
visible | Banner visibility. Initially banner is not visible. |
ADBannerView | Creates a banner view with given type and auto-layout params. |
IsAvailable | Checks if the banner type is available (e.g. MediumRect is available only starting with ios6). |
BannerWasClickedDelegate | Will be fired when banner was clicked. |
BannerWasLoadedDelegate | Will be fired when banner loaded new ad. |