Search Unity

Banner SetPosition works in editor but not working in published game

Discussion in 'Unity Ads & User Acquisition' started by cemugurk, Sep 27, 2019.

  1. cemugurk

    cemugurk

    Joined:
    Nov 27, 2014
    Posts:
    33
    Hi,
    I implemented my banner like below:
    Code (CSharp):
    1. IEnumerator LoadAds()
    2. {
    3.         //wait for ad init
    4.         while (!Advertisement.isInitialized)
    5.         {
    6.             yield return null;
    7.         }
    8.         //banner laod
    9.         BannerLoadOptions loadOptions = new BannerLoadOptions
    10.         {
    11.             loadCallback = OnBannerLoaded,
    12.             errorCallback = OnBannerError
    13.         };
    14.         Advertisement.Banner.Load(bannerPlacementId, loadOptions);
    15.  
    16.         //rewarded load
    17.         Advertisement.Load(rewardedPlacementId);
    18.         //video load
    19.         Advertisement.Load(videoPlacementId);
    20. }
    21.  
    22. IEnumerator PrepareBannerToShow()
    23.  {
    24.         while (!Advertisement.Banner.isLoaded)
    25.         {
    26.             yield return null;
    27.         }
    28.  
    29.         while (!Advertisement.IsReady(bannerPlacementId))
    30.         {
    31.             yield return null;
    32.         }
    33.  
    34.         Advertisement.Banner.Show(bannerPlacementId);
    35.         Advertisement.Banner.SetPosition (BannerPosition.TOP_CENTER);
    36. }
    Banner ads and positioning working well in test mode in the editor. In device testings, I noticed that the banner started in the bottom then 20-30 seconds after changed its position to top-center. So, I thought that would be an issue because of test ads.

    Today my game published on google play here is the link:
    https://play.google.com/store/apps/details?id=com.pinuscraft.VillageDefence

    I've tested on two different devices and banner ad loading but sitting on bottom only. And I noticed, sometimes does not load at all.

    Can anyone help me with this?
     
  2. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    I would try setting the banner position before loading the banner.

    It's possible that there are not many banner ads available for your region. We are working to improve the fill rate for banners.
     
    legionair4 likes this.