广告聚合

Show Ads

Showing Fullscreen Ads 🔗

Fullscreen Placements must be first loaded, see section Load Ads for more information.

Similar to the new load API. The new Fullscreen API utilizes C# async/await in order to request ad show. See below for details on implementation:

// Check for existing Ad 
if (_fullscreenAd == null)
   return;


// Make a load request
var adShowResult = await _fullscreenAd.Show();
var error = adShowResult.error;


// Failed to Show
if (error.HasValue)
{
   Debug.Log($"Fullscreen Failed to Show with Value: {error?.code}, {error?.message}");
   return;
}


// Successful Fullscreen Show. This will only finish after the ad show is completed.
var metrics = adShowResult.metrics;
Debug.Log($"Fullscreen Ad Did Show: {JsonConvert.SerializeObject(metrics, Formatting.Indented)}");

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 (_fullscreenPlacement != null)
    {
        _fullscreenPlacement.Invalidate();
        Debug.Log("Invalidated an existing fullscreen");
    }
    if (_bannerAd != null)
    if (_bannerView != null)
    {
        _bannerAd.ClearLoaded();
        _bannerAd.Destroy();
        _bannerView.Reset();
        _bannerView.Destroy();
        Debug.Log("Destroyed an existing banner");
    }
    if(_unityBannerAd != null)
    {       
        _unityBannerAd.Reset();
        Destroy(_unityBannerAd.gameobject);
        Debug.Log("Destroyed an existing banner");
    }
}