Unity Rewarded Video Configuration

1. Set the Rewarded Video Ad Delegate Method

MAS 4.3.2 and below

Yodo1U3dMas.SetRewardedAdDelegate((Yodo1U3dAdEvent adEvent, Yodo1U3dAdError error) => {
    Debug.Log("[Yodo1 Mas] RewardVideoDelegate:" + adEvent.ToString() + "\n" + error.ToString());
    switch (adEvent)
    {
        case Yodo1U3dAdEvent.AdClosed:
            Debug.Log("[Yodo1 Mas] Reward video ad has been closed.");
            break;
        case Yodo1U3dAdEvent.AdOpened:
            Debug.Log("[Yodo1 Mas] Reward video ad has shown successful.");
            break;
        case Yodo1U3dAdEvent.AdError:
            Debug.Log("[Yodo1 Mas] Reward video ad error, " + error);
            break;
        case Yodo1U3dAdEvent.AdReward:
            Debug.Log("[Yodo1 Mas] Reward video ad reward, give rewards to the player.");
            break;
    }

});

MAS 4.4 and above

private void InitializeRewardedAds()
{
	// Add Events
    Yodo1U3dMasCallback.Rewarded.OnAdOpenedEvent += OnRewardedAdOpenedEvent;
    Yodo1U3dMasCallback.Rewarded.OnAdClosedEvent += OnRewardedAdClosedEvent;
    Yodo1U3dMasCallback.Rewarded.OnAdReceivedRewardEvent += OnAdReceivedRewardEvent;
    Yodo1U3dMasCallback.Rewarded.OnAdErrorEvent += OnRewardedAdErorEvent;
}

private void OnRewardedAdOpenedEvent()
{
    Debug.Log("[Yodo1 Mas] Rewarded ad opened");
}

private void OnRewardedAdClosedEvent()
{
    Debug.Log("[Yodo1 Mas] Rewarded ad closed");
}

private void OnAdReceivedRewardEvent()
{
    Debug.Log("[Yodo1 Mas] Rewarded ad received reward");
}

private void OnRewardedAdErorEvent(Yodo1U3dAdError adError)
{
    Debug.Log("[Yodo1 Mas] Rewarded ad error - " + adError.ToString());
}

2. Check Rewarded Video Ad Loading Status

bool isLoaded = Yodo1U3dMas.IsRewardedAdLoaded();


3. Show Rewarded Video Ad

Yodo1U3dMas.ShowRewardedAd();

4. Create a Rewarded Video Placement

Simply add the placement name as a string into the parentheses.

Yodo1U3dMas.ShowRewardedAd("Placement_Name");

You can find more details about the ad placements here.

Updated on December 21, 2021

Was this article helpful?

Related Articles