Hi all,
Hopefully there’s a straightforward solution to this so I’ll get straight to it.
I’ve set up the Unity Ads script using UnityEngine.Advertisements instead of the old Monetization, but I’ve come across some minor issues with it that I’m struggling to overcome without some workaround.
Using Monetization I could create an ad, have a callback for that ad and set the rewards to give at the end. In the new system you don’t seem to set which callback the ad goes to, so there’s just one for all ads, leaving me wondering how I can give different rewards.
In my AdManager script there are 2 functions (pasted below) that are used, one to play the ad, one for the callback to give rewards. But if I can’t set which callback is used by which ad, then I can only call “ShowRewardedVideo” from any ad button, and then it will always give the same rewards.
Hopefully this make sense, below are the two functions within the AdManager script that I’m using. Any help is appreciated.
public void ShowRewardedVideo()
{
if (Advertisement.IsReady(myPlacementId))
{
Advertisement.Show(myPlacementId);
}
else
{
print("Rewarded video not ready");
}
}
public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
{
// Define conditional logic for each ad completion status:
if (showResult == ShowResult.Finished)
{
print("Ad completed");
}
else if (showResult == ShowResult.Skipped)
{
print("Ad skipped");
}
else if (showResult == ShowResult.Failed)
{
print("Ad failed");
}
}
Here is an example of what I’m trying to do from my game:
Rewarded Ad 1
The player presses the button, watches the ad, and is given 100 coins
Reward Ad 2
The player presses the button, watches the ad, and is loaded into a new level
It feels like the only way I can see it’s intended to work is by adding a new placement ID for every rewarded ad you have in your game… which seems crazy as then surely you’re juggling multiple ads to be ready to show, instead of 1/2.