Hiding iADs on scene unload

Hi,

I’m currently trying to implement iAD in my game so that ads show on the “Game Over” scene of my game. This works fine,except that as soon as I leave my “game over” scene and restart the game the ads still show. To get over this I tried setting

bannerView.visible = false;

when a user taps to starts a new game. This worked, except now the Ads don’t show on subsequent Game over screens. Only the first time. I updated my Update() method to then use

if (banner.loaded) {
banner.visible = true;
}else{

banner.visible = false;

}

But again this doesn’t seem to have any effect.

I attached this script to a gameObject that was only visible in my gameOver scene, but again depending on my scenarios above, it always ends up showing or stops showing after the first time.

Does anyone know how I’m actually meant to accomplish this?

Thanks

Well for what it’s worth I’ve worked out how to do this. I know it’s only a simple thing, but the docs for this are very lacking and I don’t think my scenario above is that uncommon. The code for my ad to display/hide is as follows. I’m just using a simple “tap” gesture to switch scenes here so you might need to adjust it to suit your needs

using UnityEngine;
using System.Collections;

public class adtest : MonoBehaviour {


	private ADBannerView banner= null;
	private bool show = true;  // this extra boolean is used just to ensure that the banner won't get recreated in the update() function after it has been destroyed but before the next scene has been loaded

	void Start(){
		show = true;
	}

	void Update () {
		if (banner == null  show == true) {
			CreateBanner();
		}
		if (Input.GetMouseButtonDown (0)) {
			show = false;
			banner.visible = false;
			banner = null;
			ADBannerView.onBannerWasLoaded  -= OnBannerLoaded; // Very important that this is called
			Application.LoadLevel("scene1");
			
		}
	}

	void CreateBanner(){
		banner = new ADBannerView(ADBannerView.Type.Banner, ADBannerView.Layout.Top);
		ADBannerView.onBannerWasLoaded  += OnBannerLoaded;
	}

	void OnBannerLoaded()
	{
		Debug.Log("Loaded!\n");
		banner.visible = true;

I hope someone else finds this useful

i need some information related to adding iAds in unity in IOS projects. please guide me regarding this as soon as possible

I’m not sure how I can guide you without any information plus I’m pretty new to this myself,but if you have an issue I suggest you start your own thread and see if people can help