Unity Banner ads only work in test mode, and does not deliver real ads. Is there an issue with the banner ads? Or there are simply no real banner ads to display yet?
I see no error. I use the following code for init:
if (Application.platform == RuntimePlatform.Android)
Monetization.Initialize(platformData.androidGameId, platformData.unityTestMode);
else if (Application.platform == RuntimePlatform.IPhonePlayer)
Monetization.Initialize(platformData.appleGameId, platformData.unityTestMode);
if (adsEnabled)
{
Advertisement.Banner.Load(platformData.bannerAdId);
}
and then I call the following function:
public static void ShowUnityBannerAd()
{
if (adsEnabled)
{
Advertisement.Banner.Show(platformData.bannerAdId);
}
}
I am trying on an Android device (LG G4). platformData.bannerAdId and platformData.androidGameId has the correct id’s, and adsEnabled is set to true.
Also, there is another issue. If I call ShowUnityBannerAd function at start, the banner does not appear. But if I call it 4 seconds after start, it appears.
Also, does Unity Banner ads shows AdMob ads as well, or only Unity specific banner ads?
Advertisement.Initialize(platformData.androidGameId, platformData.unityTestMode);
instead of Monetization.Initialize(platformData.androidGameId, platformData.unityTestMode);
?
You can add options to Advertisement.Banner.Load to get a callback when load has succeeded or failed :
public void LoadBanner()
{
BannerLoadOptions options = new BannerLoadOptions { loadCallback = OnLoadBannerSuccess, errorCallback = OnLoadBannerFail };
Advertisement.Banner.Load(bannerPlacementId, options);
}
private void OnLoadBannerSuccess()
{
Debug.Log("OnLoadBannerSuccess");
BannerOptions options = new BannerOptions { showCallback = OnShowBanner, hideCallback = OnHideBanner };
Advertisement.Banner.Show(bannerPlacementId, options);
}
private void OnLoadBannerFail(string message)
{
Debug.LogError("OnLoadBannerFail reason : " + message);
//retry to show banner maybe if the reason was that the placement was not ready
}
That way you can see if there is an error during the loading of the Banner and show it only when it’s loaded.
Hope it helps you !
Edit:
For me the banners show in non-test mode only when I set the “override client test mode” to “Force test mode OFF (i.e. use production ads) for all devices” in the plateform settings on https://operate.dashboard.unity3d.com/ → Monetization → Plateforms → Google Play Store/ Apple App Store → Settings
Edit 2:
In fact it as worked for a few minutes but now I just get the error : “Banner placement ‘horizontalBanner’ is not ready”
We are aware of 3 issues with Banners at the moment:
Our documentation could be a bit clearer around checking the placement status and using callbacks. The examples in this thread are more comprehensive and we’ll get our docs updated as soon as we can.
Banners are not currently supported for players in the EU. We are still finalizing our GDPR solution for banners.
Since this is a new feature for us, there isn’t a ton of banner ad inventory at the moment. We expect fill for banner ads to ramp up over time.
If you are in Europe, then that is likely the reason.
Otherwise, there may be times where a banner ad is not available, even if you implemented your code correctly. There is an expected ramp up period, but Unity is working toward fulfilling a majority of ad requests.
i have an issue with unity banner ads not shown when test mode false . onUnityBannerErrors i receive a message “Banner placement is not ready”
i’m using android studio for showing banner test is working perfect.
for implementation i follow the unity3d official documentation. https://unityads.unity3d.com/help/android/integration-guide-android
Banners are now available in all regions, depending on our available inventory. We’re currently working with our demand partners to ensure Unity developers are able to receive bids and impressions. There is an expected ramp up period but Unity is working toward fulfilling a majority of ad requests.
And it does not depend on the callbacks (LoadCallback and ErrorCallback).
Sometimes it is: “OnLoadBannerSuccess”
And sometimes it is: “OnLoadBannerFail reason: Banner placement Small_Banners is not ready.”
But Advertisement.IsReady(…) is always FALSE.
Additional question.
Why did you implement the “Load()” method?
It is not used in your example:
I’m also failing to get live banner ads showing (works fine in the editor, I see the dummy banner). This is the code I’m using:-
using System.Collections;
using UnityEngine;
using UnityEngine.Advertisements;
[RequireComponent(typeof(MonetizationManager))]
public class UnityBannerAd : MonoBehaviour
{
public string bannerPlacement = "banner";
void Start()
{
Advertisement.Initialize(MonetizationManager.Instance.gameId, MonetizationManager.Instance.testMode);
Debug.Log($"Advertisement.isInitialized {Advertisement.isInitialized}");
StartCoroutine(ShowBannerWhenReady());
}
IEnumerator ShowBannerWhenReady()
{
Debug.Log($"Waiting for banner {bannerPlacement}");
while (!Advertisement.IsReady(bannerPlacement))
{
yield return new WaitForSeconds(0.5f);
}
Debug.Log("Banner ready");
Advertisement.Banner.Show(bannerPlacement);
}
}
I see the log entry ‘Banner ready’, so the system thinks it’s good to go, but the banner never shows. So I’m not sure if this means there is no ad available to fulfil the request, or if it’s something else.
I be grateful for some advice on whether it’s just a case of waiting a bit longer for the banner format to get up to speed or if I’m missing something.