Hi,
I am trying to implement a rewarded Ad like this:
void Start ()
{
if (Monetization.isSupported)
{
Monetization.Initialize(gameId, testMode);
}
}
public void ShowAd() //Called via Button Click
{
StartCoroutine(WaitForAd());
}
IEnumerator WaitForAd()
{
//STUCK HERE, ALWAYS FALSE
while (!Monetization.IsReady(placementId))
{
yield return null;
}
ShowAdPlacementContent ad = null;
ad = Monetization.GetPlacementContent(placementId) as ShowAdPlacementContent;
if (ad != null)
{
ad.Show(HandleShowResult);
}
}
In the Unity Editor (2018.4.0f1) the Monetization.IsReady(placementId) always returns false. On Android nothing happens either.
I tried it this way:
ShowAdCallbacks options = new ShowAdCallbacks();
options.finishCallback = HandleShowResult;
ShowAdPlacementContent ad = Monetization.GetPlacementContent(placementId) as ShowAdPlacementContent;
ad.Show(options);
This works in the Editor, I get a test ad from Unity, but on Android I get a NullPointerException this way. I double checked the game ID. It should be this one:
What could be the problem?! The placementID is the default “rewardedVideo”.
I deactivated the built-In Unity Service and added the Unity Monetization 3.0.3 from the Asset store.
If this will not work I think I have to switch to Google Ads and see if this works better for the game.