- Home /
(Ads) initializationListener is null, you will not receive any callbacks
The title explains it all, any idea why this could be happening & how I can fix it? Full error:
initializationListener is null, you will not receive any callbacks UnityEngine.Advertisements.Advertisement:Initialize (string)
Answer by ATate · Jun 01 at 03:02 PM
@BranditTheBandit With Unity Ads, if you want it to tell you when it has finished or failed initialization. you need to give it a class instance that can receive the messages.
This class needs to implement the initializationListener interface.
The interface can be implemented in the same class you are calling the initialize routine from, or another class - something like this.
public class MyClass : IUnityAdsInitializationListener
{
// Called from outside this class
public void Initialize()
{
Advertisement.Initialize(advertisingID, testMode, this);
}
void OnInitializationComplete()
{
// Do something
}
void OnInitializationFailed(UnityAdsInitializationError error, string message);
{
// Do Something
}
}
Its all in the SDK reference guide: Unity Ads
All the call backs in Unity ads (ad loaded, shown, etc) are achieved via various interfaces. The same class can implement all of them if you wish.
Your answer
Follow this Question
Related Questions
I can't use google admob ads 1 Answer
Why am i getting a null reference? 1 Answer
CAN SOMEONE FINALLY HELP ME! 3 Answers
Argument cannot be Null??, 2 Answers
Null reference exception error in Unity, Please Help! 1 Answer