Hello , I have a problem with deleting my ad banner at the bottom of the screen. I have one scene with gameplay only and after players death I have some buttons (restart, main menu , quit) so I added my banner script to empty gameobject and it turns on after death. But when I click restart or main menu the banner stays at the bottom of the screen. I know I have to delete it somehow, but I don’t know when and how. I want to banner disappear when players click main menu or restart. I’m using test ad id.
Thank you guys for your time.
Here is my code :
using UnityEngine;
using System.Collections;
using GoogleMobileAds.Api;
public class Admob : MonoBehaviour
{
// Use this for initialization
void Start()
{
//Request Ads
RequestBanner();
}
private void RequestBanner()
{
#if UNITY_EDITOR
string adUnitId = "unused";
#elif UNITY_ANDROID
string adUnitId = "ca-app-pub-3940256099942544/6300978111";
#elif UNITY_IPHONE
string adUnitId = "INSERT_IOS_BANNER_AD_UNIT_ID_HERE";
#else
string adUnitId = "unexpected_platform";
#endif
// Create a 320x50 banner at the bottom of the screen.
BannerView bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Bottom);
// Create an empty ad request.
AdRequest request = new AdRequest.Builder().Build();
// Load the banner with the request.
bannerView.LoadAd(request);
}
}