Hi all,
I’m using the code below to display iAds at the top of my screen and disable them when it detects the ‘End iAds’ gameobject.
But I am having a couple of problems:
- If a banner doesn’t load, the app crashes when it tries to banner.Hide();
- When the test banner does load and it tries to refresh, if it does not receive a refreshed ad i just get a white banner across the
top of my screen. and the banner.Hide(); command doesn’t remove it.
pragma strict
private var banner : ADBannerView = null;
function Start () {
banner = new ADBannerView();
banner.autoSize = true;
banner.autoPosition = ADPosition.Top;
StartCoroutine(ShowBanner());
}
function ShowBanner () {
yield WaitForSeconds (2.0f);
StartCoroutine(ShowBanner2());
}
function ShowBanner2() {
while (!banner.loaded banner.error == null)
yield;
if (banner.error == null)
banner.Show();
else banner = null;
}
function Update () {
if (GameObject.Find("End iAds") != null)
{
banner.Hide();
}
}
Any help would be appreciated.
Thanks.