【发布时间】:2021-04-21 04:14:44
【问题描述】:
最近我决定在游戏中添加 google admob 横幅广告。我已经按照指南的每一步操作,也添加了我们的 ad-unit-id。所以一切都很好,很酷,但突然横幅变大了,并以大约三倍(甚至更大)横幅本身的大小显示视频。
我正在使用统一 2020.1.13 并且我已经测试了不同的横幅尺寸作为 admob 指南建议(SmartBanner、AdaptiveBanner、(默认小)横幅,...)一切。但它每次都在打我的脸。以下图像是正常尺寸(我希望它保持不变)和较大的版本,在 10 次中出现 2-3 次。
请求横幅的代码是:
public void RequestBanner(string unitID)
{
// Clean up banner ad before creating a new one.
if (this.bannerViewAd != null)
{
Debug.Log("|||| Prev Banner removed!");
this.bannerViewAd.Destroy();
}
AdSize adaptiveSize =
AdSize.GetPortraitAnchoredAdaptiveBannerAdSizeWithWidth(AdSize.FullWidth);
// Create a 320x50 banner at the top of the screen.
this.bannerViewAd = new BannerView(unitID, adaptiveSize, AdPosition.Bottom);
// Called when an ad request has successfully loaded.
this.bannerViewAd.OnAdLoaded += this.HandleOnAdLoaded;
// Called when an ad request failed to load.
this.bannerViewAd.OnAdFailedToLoad += this.HandleOnAdFailedToLoad;
// Called when an ad is clicked.
this.bannerViewAd.OnAdOpening += this.HandleOnAdOpened;
// Called when the user returned from the app after an ad click.
this.bannerViewAd.OnAdClosed += this.HandleOnAdClosed;
// Called when the ad click caused the user to leave the application.
this.bannerViewAd.OnAdLeavingApplication += this.HandleOnAdLeavingApplication;
// Create an empty ad request.
AdRequest adRequest = new AdRequest.Builder().Build();
// Load the banner with the request.
this.bannerViewAd.LoadAd(adRequest);
}
在代码中你看到了adaptivesize和constantSize,我测试了两者并得出了相同的结果,我也测试了智能横幅和相同的结果。
【问题讨论】:
-
这也发生在我的原生 Android 应用上。使用 AdMob SDK “AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize()” 中的方法设置 adSize 这是预期的广告横幅尺寸:ibb.co/L1dh971 这是错误的屏幕截图: 半屏块:ibb.co/kJkBzGd 全屏块:ibb.co/1snkTh5
-
@NoelChew 我也在 github 的 admob 包仓库上打开了这个 issue,下面的链接会重定向到这个 issue。经过几天寻找解决方案,我们放弃了视频横幅来解决这个问题。 github.com/googleads/googleads-mobile-unity/issues/1557
标签: unity3d admob banner banner-ads