Admob bannerview loadrequest call导致游戏闪烁或混蛋

时间:2016-08-24 22:13:10

标签: admob unity5

我想尽可能有效地利用AdMob和Chartboost这两个最好的广告网络将我的新游戏货币化。在显示插页式广告时,我之前遇到过延迟和类似的问题。为了避免这种情况,我在尝试显示之前预先加载了admob并缓存了cb插页式广告。它在某种程度上起作用,我可以看到改进。

但问题出在AdMob横幅上。正如我在上一个问题中已经提到的那样,因为每当我进入游戏界面时我都会破坏并创建bannerview,我可以看到我的游戏一瞬间闪烁。这是因为横幅视图LoadRequest()触发。

在另一个线程中调用Admob LoadRequest解决了这个问题?

如果是这样,如何在unity5的单独线程中触发Admob bannerview loadrequest?

更新

// Create a 320x50 banner at the top of the screen.
     BannerView bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Top);
     // Create an empty ad request.
     AdRequest request = new AdRequest.Builder().Build();
     // Load the banner with the request.
     bannerView.LoadAd(request);

1 个答案:

答案 0 :(得分:0)

最好将此实现放在StartCoroutine()中。例如,

StartCoroutine(createBannerView());

IEnumerator createBannerView() {
   yield return new WaitForEndOfFrame(); 
// Create a 320x50 banner at the top of the screen.
     BannerView bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Top);
     // Create an empty ad request.
     AdRequest request = new AdRequest.Builder().Build();
     // Load the banner with the request.
     bannerView.LoadAd(request);

}

要解决您的闪烁问题,请确保在进入游戏区域之前调用此方法。我不认为LoadRequest导致任何闪烁的东西,因为这些网络调用通常在后台发生,并且不会中断Update()或FixedUpdate()。