I’ve implemented Unity Ads by using Advertisement Legacy on my android-only mobile game.
I have a button that would show an ad when pressed, but that button appears greyed out when I play the game build on mobile (this happens both on an .apk and .aab build).
The lines that puzzle me in a LogCat log that I took from my most recent test:
2024/10/07 19:57:25.964 5029 5055 Error Unity Initializing Unity Ads.
2024/10/07 19:57:25.964 5029 5055 Error Unity UnityEngine.Advertisements.Advertisement:CreatePlatform()
2024/10/07 19:57:25.964 5029 5055 Error Unity UnityEngine.Advertisements.Advertisement:.cctor()
2024/10/07 19:57:25.964 5029 5055 Error Unity AdsInitializer:InitializeAds()
AdsInitializer is the name of the script where I initialize my ads, in the InitializeAds() function. The whole script looks like this:
public class AdsInitializer : MonoBehaviour, IUnityAdsInitializationListener
{
[SerializeField] string _gameId;
[SerializeField] bool _testMode;
void Awake()
{
InitializeAds();
}
public void InitializeAds()
{
if (!Advertisement.isInitialized && Advertisement.isSupported)
{
Advertisement.Initialize(_gameId, _testMode, this);
}
}
public void OnInitializationComplete()
{
Debug.Log("Unity Ads initialization complete.");
}
public void OnInitializationFailed(UnityAdsInitializationError error, string message)
{
Debug.Log($"Unity Ads Initialization Failed: {error.ToString()} - {message}");
}
}
I never get either debug logs in the logcat from OnInitializationComplete or OnInitializationFailed. Just that weird ‘error’ message saying “Initializing Unity Ads.”.
If anyone has any ideas or pointers I would be very glad to hear them.
Thank you in advance.