Hi, I’ve implemented unity ads a couple of weeks ago and now I want to use it. In the editor you see the ad banner with “this would be your banner” but after I’ve built the game and run it on my phone it doesn’t show an ad.
I’m using unity 2020.1.2f1.
Development build is off in the Build settnigs
ads are turned on in the services tab.
test mode is off (both in the editor and in the code).
the game ID’s are correct (again both in the editor and in the code).
placementid is correct.
Does anyone know what I’ve done wrong or what I need to enable in the build settings?
thanks!
this is my code (not my real gameID):
using System.Collections;
using UnityEngine;
using UnityEngine.Advertisements;
public class adScript : MonoBehaviour
{
public string gameId = "1111111";
public string placementId = "BannerBottom";
public bool testMode = false;
void Start()
{
//Advertisement.Initialize(gameId);
//StartCoroutine(ShowBannerWhenInitialized());
Advertisement.Initialize(gameId, testMode);
StartCoroutine(ShowBannerWhenInitialized());
}
IEnumerator ShowBannerWhenInitialized()
{
while (!Advertisement.IsReady(placementId))
{
yield return new WaitForSeconds(0.5f);
}
Advertisement.Banner.SetPosition(BannerPosition.BOTTOM_CENTER);
Advertisement.Banner.Show(placementId);
}
}
Hi, normally this is caused by accidentally leaving the checkbox enabled in the editor, being a public bool the editor option will overwrite it’s initial state. It is also possible that you are initializing the SDK elsewhere with testMode set to true. This is a fairly common mistake.
Failing this you can go into the project settings for this project on the Unity Dashboard and use the Force Test Mode options to force testMode on or off for your application. Bare in mind however that this will effect ALL builds of your app.
Hi, thanks for the reply.
I enabled “Force test mode off” in de unity dashboard but sadly that didn’t solve the problem. I’m still not seeing the ad after I’ve built it. I live in the Netherlands so I’m not sure if there are ads in my region but I’m hoping you maybe have another solution?
Hi, it is very possible then that this is a banner fill issue. The easiest way to tell if this is the case is to inspect the device logs for your app. You can most easily do this by using the Android Logcat package for Unity or by using Logcat via the Android Studio. You can find instructions on using it here.
Once you have the logs you will be looking for messages with the UnityAds tag. Try looking for any logs that say something along the lines of ‘Error: No fill for Banner placement’. If you don’t see this log it is likely that your issue lies elsewhere.
Thanks for the reply again!
I was just about to do the thing you said until I started up unity and saw these errors.
Normally I just ignored them because my game seemed to work but when then I saw something about com.unity.ads.
do you have any idea on how to fix those errors? and are these errors maybe the problem?
This is the folder the error is coming from:
Hi, it looks like you may have multiple instances of the Unity Ads SDK added into your project. As the images you have sent are part of the template ads project.