Search Unity

Unity Banner Ads top of screen?

Discussion in 'Unity Ads & User Acquisition' started by Gothrond, Oct 31, 2018.

Thread Status:
Not open for further replies.
  1. Gothrond

    Gothrond

    Joined:
    Jul 2, 2014
    Posts:
    6
    Just need to know, so currently unity documentation says the new Unity banner ads can only be placed at bottom center of screen. How soon until we will be able to place them top center of game screen?
     
  2. RossRothenstineU3D

    RossRothenstineU3D

    Unity Technologies

    Joined:
    Oct 26, 2018
    Posts:
    4
    Hello,

    We have this on our roadmap! It will be in our next release.

    The expected API will be something like:

    Advertisement.Banner.position = BannerPosition.TopAndCenter;


    Note that it will still default to BottomAndCenter if you don't set anything.

    Feel free to give feedback on our API as well.

    RR
     
    lei999 and zinmaster like this.
  3. i9mobile

    i9mobile

    Joined:
    Aug 8, 2013
    Posts:
    54
    Nice! Waiting for it!
     
  4. UMAIRJAVED66

    UMAIRJAVED66

    Joined:
    Dec 14, 2017
    Posts:
    1
    @RossRothenstineU3D I am testing on iphone 5s and banner ad is few pixels (8 pixels) above from screen bottom boundary. Is it something intentional. I tried to reposition it to bottom but it get re positioned after some time again.
    I am talking about ios sdk UnityAds-3.0.0.
     
  5. zinmaster

    zinmaster

    Joined:
    Mar 2, 2014
    Posts:
    1
    Hello, I have 2 questions sir...

    1. Do you have a date for the next release? I really do need the option to place banner at the top as well.

    2. Are Unity banner ads small(er) compared to others? i.e. My test ads show it centered at the bottom utilizing only about 70-80 of the screen width. This is my first use of banner ads so I wasn't sure if this was typical. I was investigating Admob and theirs fill to side of screen.
     
  6. daolavi

    daolavi

    Joined:
    May 12, 2013
    Posts:
    2
    Hi RossRothenstineU3D, any updates from your side?
     
  7. v_osnovnom_bezvreden

    v_osnovnom_bezvreden

    Joined:
    Jan 9, 2017
    Posts:
    7
     
    Advertisement.Banner.SetPosition(BannerPosition.TOP_CENTER);
    works for me.
     
  8. daolavi

    daolavi

    Joined:
    May 12, 2013
    Posts:
    2
    Thanks for your update
     
    unity_oeMZSDS9APQlWQ likes this.
  9. UDN_2ceb434f-3541-4509-8c8f-c3d394fc80c5

    UDN_2ceb434f-3541-4509-8c8f-c3d394fc80c5

    Joined:
    Aug 5, 2018
    Posts:
    1
    Trying to add the Banner ad to the top as is stated that it is working. But im really bad with scripting can someone please help me.
    using System.Collections;
    using UnityEngine;
    using UnityEngine.Advertisements;

    public class UnityBannerAd : MonoBehaviour
    {
    public bool testMode = false;

    #if UNITY_IOS
    public const string store_id = "";
    #elif UNITY_ANDROID
    public const string store_id = "";
    #endif
    private string bannerPlacement = "";
    void Awake()
    {
    #if UNITY_IOS || UNITY_ANDROID
    Advertisement.Initialize (store_id, false);
    StartCoroutine (ShowBannerWhenReady ());
    #endif
    }
    IEnumerator ShowBannerWhenReady()
    {
    while (!Advertisement.IsReady(bannerPlacement))
    {
    yield return new WaitForSeconds (0.5f);
    }
    Debug.Log("showin!");
    Advertisement.Banner.Show(bannerPlacement);
    }
    public void HideBanner()
    {
    Advertisement.Banner.Hide();
    }

    public void ShowBanner()
    {
    Advertisement.Banner.Show(bannerPlacement);
    }
    }
     
  10. Darkwolf911

    Darkwolf911

    Joined:
    Nov 20, 2016
    Posts:
    1
    In case you haven't solved this, or if any future people find this post:

    After spending a while fighting this to get a successful solution, try changing:

    #if UNITY_IOS || UNITY_ANDROID
    Advertisement.Initialize (store_id, false);
    StartCoroutine (ShowBannerWhenReady ());

    to :

    Advertisement.Initialize (store_id, false);
    Advertisement.Banner.SetPosition(BannerPosition.TOP_MIDDLE);
    StartCoroutine(ShowBannerWhenReady());

    A complete, working script (replace ##### with your gameID and PLACEMENTNAME with the name of your placement):

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.Advertisements;

    public class BannerAd : MonoBehaviour
    {

    public string bannerPlacement = "PLACEMENTNAME";
    public bool testMode = false;

    #if UNITY_IOS
    public const string gameID = "####";
    #elif UNITY_ANDROID
    public const string gameID = "####";
    #elif UNITY_EDITOR
    public const string gameID = "####";
    #endif

    void Start()
    {
    Advertisement.Initialize(gameID, false);
    Advertisement.Banner.SetPosition(BannerPosition.BOTTOM_LEFT);
    StartCoroutine(ShowBannerWhenReady());
    }

    IEnumerator ShowBannerWhenReady()
    {
    while (!Advertisement.IsReady("PLACEMENTNAME"))
    {
    yield return new WaitForSeconds(0.5f);
    }
    Advertisement.Banner.Show(bannerPlacement);
    }
    }
     
  11. engyasserlr

    engyasserlr

    Joined:
    Nov 13, 2020
    Posts:
    4
    It works just fine!! thank you so much for the tip
     
Thread Status:
Not open for further replies.