在我的游戏中,每个场景中都有横幅,而插页式广告则显示每隔4个GameOver。因此,我有Admob横幅和插页式广告。横幅广告效果很好,但插页式广告仅显示一次,但下次则不显示。有人可以帮助我弄清楚如何在每次需要时加载非页内广告。
我的AdManager
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using admob;
public class AdManager : MonoBehaviour
{
public static AdManager Instance{set;get;}
public string VideoId;
public string BannerId;
public void Start() {
Instance = this;
DontDestroyOnLoad (gameObject);
#if UNITY_EDITOR
#elif UNITY_IOS
Admob.Instance().initAdmob(BannerId,VideoId);
Admob.Instance().setTesting(true);
Admob.Instance().loadInterstitial ();
#endif
}
public void Update() {
Instance = this;
DontDestroyOnLoad (gameObject);
#if UNITY_EDITOR
#elif UNITY_IOS
Admob.Instance().initAdmob(BannerId,VideoId);
Admob.Instance().setTesting(true);
Admob.Instance().loadInterstitial ();
#endif
}
public void ShowBanner() {
#if UNITY_EDITOR
Debug.Log("[BANNER] Unable to play ads from EDITOR");
#elif UNITY_IOS
//Here define the size of the banner - new AdSize( width , height )
AdSize adSize = new AdSize(350, 50);
Admob.Instance().showBannerRelative(adSize, AdPosition.BOTTOM_CENTER, 5);
#endif
}
public void ShowVideo() {
Debug.LogError("[VIDEO] isInterstitialReady: " + Admob.Instance().isInterstitialReady());
#if UNITY_EDITOR
Debug.Log("[VIDEO] Unable to play ads from EDITOR");
#elif UNITY_IOS
Debug.LogError("[VIDEO] isInterstitialReady: " + Admob.Instance().isInterstitialReady());
if (Admob.Instance().isInterstitialReady())
{
Admob.Instance().showInterstitial();
}else{
Debug.Log("Should not be playing video");
Admob.Instance().loadInterstitial();
Admob.Instance().showInterstitial();
}
Debug.LogError("[VIDEO] isInterstitialReady: " + Admob.Instance().isInterstitialReady());
//Destroy(gameObject);
#endif
}
}