Cant connect banner Unity ADs

In unity i see
4732049--448220--upload_2019-7-10_15-11-27.png
in game on phone the banner doesnt appear.

Code im using for it:

private string myPlacementIdBanner = "fullgamebanner";

Start {

if (Advertisement.isSupported) Advertisement.Initialize ("3208172",false);
        StartCoroutine(ShowBanner());
}
IEnumerator ShowBanner()
    {
        yield return new WaitForSeconds(10);
        StartCoroutine(ShowBannerWhenReady());
          Advertisement.Show();
        //  Advertisement.Banner.Show(myPlacementIdBanner);
    }
IEnumerator ShowBannerWhenReady()
{
Debug.Log("0 Advertisement.IsReady === "+Advertisement.IsReady(myPlacementIdBanner));
while (!Advertisement.IsReady(myPlacementIdBanner))
{

yield return new WaitForSeconds(0.5f);
}
Debug.Log("1 Advertisement.IsReady === "+Advertisement.IsReady(myPlacementIdBanner));
Advertisement.Banner.Show(myPlacementIdBanner);

Advertisement.Banner.Show(myPlacementIdBanner);
}

Ads in unity services are on.

and is connected in dashboard

i dont understand what’s wrong…

@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.

public void LoadBanner()
{
    if(!Advertisement.Banner.isLoaded)
    {
        BannerLoadOptions loadOptions = new BannerLoadOptions
        {
            loadCallback = OnBannerLoaded,
            errorCallback = OnBannerError
        };
        Advertisement.Banner.Load(placement, loadOptions);
    }
}
void OnBannerLoaded()
{
    Debug.Log("Banner Loaded");
    Advertisement.Banner.Show(placement);
}

void OnBannerError(string error)
{
    Debug.Log("Banner Error: " + error);
}

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.

I have tried a lot of methods , but the problem not was in code


im just going to change to other Ads Platform.

1 Like