Documentation Index
Fetch the complete documentation index at: https://guide.daro.so/llms.txt
Use this file to discover all available pages before exploring further.
- User-initiated video ads that grant rewards after completed views.
- Grant rewards only from the
OnEarnedReward event.
Integrating Ads
Create Ad Instance
private DaroRewardedAd ad;
ad = new DaroRewardedAd("your-rewarded-ad-unit-id");
Register Event Handlers
ad.OnAdLoaded += info => Debug.Log("rewarded loaded");
ad.OnAdFailedToLoad += error => Debug.LogWarning(error.Message);
ad.OnEarnedReward += (info, reward) =>
{
Debug.Log($"earned {reward.Amount} {reward.RewardType}");
};
Show Ad
if (ad != null && ad.IsReady())
{
ad.SetCustomData("user=12345");
ad.Show();
}
Dispose Ad
ad?.Dispose();
ad = null;
Example
using Daro;
using UnityEngine;
public sealed class RewardedHost : MonoBehaviour
{
[SerializeField] private string adUnitId = "your-rewarded-ad-unit-id";
private DaroRewardedAd ad;
private void OnEnable()
{
ad = new DaroRewardedAd(adUnitId);
ad.OnAdLoaded += info => Debug.Log("rewarded loaded");
ad.OnAdFailedToLoad += error => Debug.LogWarning(error.Message);
ad.OnEarnedReward += OnEarnedReward;
ad.OnAdDismissed += info => ad?.Load();
ad.Load();
}
public void ShowForReward()
{
if (ad != null && ad.IsReady())
{
ad.SetCustomData("user=12345");
ad.Show();
}
}
private void OnEarnedReward(DaroAdInfo info, DaroRewardItem reward)
{
Debug.Log($"earned {reward.Amount} {reward.RewardType}");
// Grant the in-game reward here.
}
private void OnDisable()
{
ad?.Dispose();
ad = null;
}
}
Do not grant rewards from OnAdDismissed. OnEarnedReward fires only after the user completes the ad.