【问题标题】:Admob bannerview loadrequest call cause game flickers or jerkAdmob Bannerview loadrequest 调用导致游戏闪烁或混蛋
【发布时间】:2016-09-07 21:47:57
【问题描述】:

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

但问题出在 AdMob 横幅上。正如我在上一个问题中已经提到的,由于我每次进入游戏屏幕时都会破坏并创建横幅视图,因此我可以看到我的游戏闪烁片刻。这是因为横幅视图 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);

【问题讨论】:

  • 能否请您发布您的代码 sn-p ?
  • 阿伦,我编辑了我的帖子。添加了用于创建横幅视图的代码 sn-p。

标签: admob unity5


【解决方案1】:

最好将此实现放在 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()。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-05-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多