How to Implement the Show Listener's OnUnityAdsShowComplete callback method

Hi, the code tells me

// Implement the Show Listener's OnUnityAdsShowComplete callback method to determine if the user gets a reward:
    public void OnUnityAdsShowComplete(string adUnitId, UnityAdsShowCompletionState showCompletionState)
    {
        if (adUnitId.Equals(_adUnitId) && showCompletionState.Equals(UnityAdsShowCompletionState.COMPLETED))
        {
            Debug.Log("Unity Ads Rewarded Ad Completed");
            // Grant a reward.
           
           
          
            // Load another ad:
            Advertisement.Load(_adUnitId, this);
        }
    }

So question is how to /Implement the Show Listener’s OnUnityAdsShowComplete callback method to determine if the user gets a reward?

Hi,

As is described in this guide, you should create two C# scripts

  • AdsInitializer
  • RewardedAdsButton

Ad these scripts to your scene and create a button to play the rewarded ad.

Note: Make sure you call the method LoadAd() in RewardedAdsButton Script, after the initialization.

Ex.

//AdsInitializer class
public void OnInitializationComplete()
{
        Debug.Log("Unity Ads initialization complete.");
        _rewardedAdsButton.LoadAd();
}

@ej-Unity is that guide updated for the new dialog Unity pops up the first time the game plays an ad? we had our code working fine until this new thing appeared and now the first ad always gets a
OnUnityAdsDidError event triggered … are these both things correlated?

Hi @pistoleta , yes, that guide is updated, looks like you have an issue with your code implementation, please open a ticket here, I will be happy to help you.

Thanks we already did.