Okay so we are using the unity built in adbannerview. We use the basic code
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;
StartCoroutine(HideBanner);
}
IEnumerator HideBanner()
{
yield return new WaitForSeconds(10);
banner.visible = false;
Destroy(this);
}
void OnDestroy()
{
ADBannerView.onBannerWasClicked -= OnBannerClicked;
ADBannerView.onBannerWasLoaded -= OnBannerLoaded;
}
And now once the banner has shown for ten seconds we call we call on Destroy that will unsubscribe from both the events and then destroy the script and empty gameobject that it is on. I know that it is a little extreme, but for some reason in our app it will display the banner at the start of the game, but then for some reason 5 minutes later it will get really laggy and I have pinpointed that it is something to do with the ad trying to receive another one. Because when we didn't fully destroy the adbanner script another ad would load around two minutes and another at 5 minutes. And once we took the ads off there was no lag around five minutes.
Do not know how to fix this.