Showing Interstitial and Rewarded Ads

When you’re ready to show an Interstitial or Rewarded ad, you can check that it’s ready to show and then display it like so:

Interstitial Ad

// Showing an Interstitial Ad
if (_interstitialAd.ReadyToShow())
    _interstitialAd.Show();
//Showing an Interstitial Ad
if (this.interstitialAd.readyToShow()){
  this.interstitialAd.show();
}
else {
  //when there’s no Ad ready to show immediately,
  //fall through to your chosen backup behavior
  this.interstitialAd.load();
}

Rewarded Ad

//Showing a Rewarded Ad
if (_rewardedAd.ReadyToShow()){
  _rewardedAd.show();
//Showing a Rewarded Ad
if (this.rewardedAd.readyToShow()){
  this.rewardedAd.show();
}
else {
  //when there’s no Ad ready to show immediately,
  //fall through to your chosen backup behavior
  this.rewardedAd.load();
}

Showing Banner Ads

Banners are now automatically shown after load, see Loading Banner Ads for more information.

Releasing Chartboost Mediation Ads

To clear resources used by Chartboost Mediation Ads, you can use the destroy method associated with the respective Ad you used.

private void OnDestroy()
{
    if (_interstitialAd != null)
    {
        _interstitialAd.ClearLoaded();
        _interstitialAd.Destroy();
        Debug.Log("Destroyed an existing interstitial");
    }
    if (_rewardedAd != null)
    {
        _rewardedAd.ClearLoaded();
        _rewardedAd.Destroy();
        Debug.Log("Destroyed an existing rewarded");
    }
    if (_bannerAd != null)
    {
        _bannerAd.ClearLoaded();
        _bannerAd.Destroy();
        Debug.Log("Destroyed an existing banner");
    }
}
void OnDestroy()
{
    // Release Interstitial Ad
    if (interstitialAd != null)
    {
        interstitialAd.clearLoaded();
        interstitialAd.destroy();
        Log("destroyed an existing interstitial");
    }
    
    // Release Rewarded Ad
    if (rewardedAd != null)
    {
        rewardedAd.clearLoaded();
        rewardedAd.destroy();
        Log("destroyed an existing rewarded");
    }
    
    // Release Banner Ad
    if (bannerAd != null)
    {
        bannerAd.clearLoaded();
        bannerAd.destroy();
        Log("destroyed an existing banner");
    }
}