Hi guys !
What is the best way to handle the results of an ad ? And when you have multiple functions calling this ad how to handle the callback ?
I'm working on this and at this time i have :
----------
- An AdsController : Regroup the methods for show bannier, fullscreen ad, and rewarded ad.
----------
It's called by this way :
IUnityAdsListener listener;
public void ShowAd(AdType adType, IUnityAdsListener _listener)
{
if (listener != null)
{
Advertisement.RemoveListener(listener);
}
listener = _listener;
Advertisement.AddListener(listener);
switch (adType)
{
case AdType.FullScreen:
ShowInterstitial();
break;
case AdType.Rewarded:
ShowRewarded();
break;
case AdType.Banner:
//TODO : Show banner
break;
}
}
----------
On the main script, for example in the HealthController, to revive the player. I Add the IUnityAdsListener and call the function "Show Ad" and passing "this" (the IUnityAdsListener just implemented).
----------
This way works pretty good, but i don't know if is an other way to do it a bit more easy to manage.
Thanks for your time :D
↧