Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Cant connect banner Unity ADs

Discussion in 'Unity Ads' started by ApricotStudio, Jul 10, 2019.

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

    ApricotStudio

    Joined:
    Jun 23, 2019
    Posts:
    2
    In unity i see
    upload_2019-7-10_15-11-27.png
    in game on phone the banner doesnt appear.

    Code im using for it:
    Code (CSharp):
    1. private string myPlacementIdBanner = "fullgamebanner";
    2.  
    3. Start {
    4.  
    5. if (Advertisement.isSupported) Advertisement.Initialize ("3208172",false);
    6.         StartCoroutine(ShowBanner());
    7. }
    8. IEnumerator ShowBanner()
    9.     {
    10.         yield return new WaitForSeconds(10);
    11.         StartCoroutine(ShowBannerWhenReady());
    12.           Advertisement.Show();
    13.         //  Advertisement.Banner.Show(myPlacementIdBanner);
    14.     }
    15. IEnumerator ShowBannerWhenReady()
    16. {
    17. Debug.Log("0 Advertisement.IsReady === "+Advertisement.IsReady(myPlacementIdBanner));
    18. while (!Advertisement.IsReady(myPlacementIdBanner))
    19. {
    20.  
    21. yield return new WaitForSeconds(0.5f);
    22. }
    23. Debug.Log("1 Advertisement.IsReady === "+Advertisement.IsReady(myPlacementIdBanner));
    24. Advertisement.Banner.Show(myPlacementIdBanner);
    25.  
    26. Advertisement.Banner.Show(myPlacementIdBanner);
    27. }
    28.  
    29.  
    Ads in unity services are on.
    upload_2019-7-10_15-14-39.png

    and is connected in dashboard
    upload_2019-7-10_15-16-16.png


    i dont understand what's wrong...
     
  2. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,277
    @ApricotStudio

    I see a couple of possible issues with the banner code you're using:
    1. The first coroutine (ShowBanner) is just waiting for 10 seconds and then calling another coroutine. It is also calling Advertisement.Show, which will not show a banner, but will instead show the default placement you have configured in your dashboard.
    2. Your second coroutine (ShowBannerWhenReady) is calling Advertisement.Banner.Show twice.

    I would actually recommend against using coroutines in this case. You should use the BannerLoadOptions callbacks to know when a banner is ready to show or if there was an error.

    Code (CSharp):
    1. public void LoadBanner()
    2. {
    3.     if(!Advertisement.Banner.isLoaded)
    4.     {
    5.         BannerLoadOptions loadOptions = new BannerLoadOptions
    6.         {
    7.             loadCallback = OnBannerLoaded,
    8.             errorCallback = OnBannerError
    9.         };
    10.         Advertisement.Banner.Load(placement, loadOptions);
    11.     }
    12. }
    13. void OnBannerLoaded()
    14. {
    15.     Debug.Log("Banner Loaded");
    16.     Advertisement.Banner.Show(placement);
    17. }
    18.  
    19. void OnBannerError(string error)
    20. {
    21.     Debug.Log("Banner Error: " + error);
    22. }
    The message from the errorCallback will also help you confirm if the problem is with the integration or if there are just no banners available at the moment. If the error message says that No Fill was available, then that is likely an issue with the network and not your integration. We are working with our demand partners to ensure Unity developers are able to receive impressions. We are still in the ramp up period but we're working toward fulfilling more banner requests.
     
  3. ApricotStudio

    ApricotStudio

    Joined:
    Jun 23, 2019
    Posts:
    2
    I have tried a lot of methods , but the problem not was in code
    upload_2019-7-11_1-49-49.png
    im just going to change to other Ads Platform.
     
    segant likes this.
Thread Status:
Not open for further replies.