User Manual

Ads API Reference

Cloud API

Namespace: MobileCore.Advertisements

AdsManager Class

The primary entry point for all advertising logic.

General Methods

MethodDescription
Initialize(AdsManagerInitializer)Initializes the module manually (usually handled by MainSystem).
IsModuleEnabled(AdProvider)Checks if a specific provider is configured and active.
ShowErrorMessage()Displays a generic “Network error” toast message.
TryToLoadFirstAds()Manually triggers the initial load of ads if auto-load was disabled.
MethodDescription
ShowBanner()Displays the banner ad.
HideBanner()Hides the banner ad and resets the auto-show timer.
DestroyBanner()Completely removes the banner instance from memory.
EnableBanner()Sets banner state to active and shows it.
DisableBanner()Sets banner state to inactive and hides it.

Fields:

  • float BannerAutoShowDelay: Time in seconds to automatically reshow a hidden banner (0 to disable).

Interstitial Ads

MethodDescription
IsInterstitialLoaded()Returns true if an ad is ready to show.
ShowInterstitial(Action<bool>, bool ignoreConditions)Shows ad. Callback returns true on close. ignoreConditions bypasses time delays.
RequestInterstitial()Manually requests a new ad fetch.
SetInterstitialDelayTime(float)Sets the delay (in seconds) before the next interstitial can be shown.
ResetInterstitialDelayTime()Resets the delay timer to the default value from Settings.

Rewarded Ads

MethodDescription
IsRewardBasedVideoLoaded()Returns true if an ad is ready.
ShowRewardBasedVideo(Action<bool>, bool showError)Shows ad. Callback returns true only if completed. showError toggles toast error messages.
RequestRewardBasedVideo()Manually requests a new ad fetch.

No Ads / Forced Ads

Use these methods to implement “Remove Ads” functionality.

MethodDescription
DisableForcedAd()Permanently disables Banners and Interstitials (saves state to PlayerPrefs).
IsForcedAdEnabled()Returns true if ads are allowed to show (i.e., “Remove Ads” not purchased).

Privacy (GDPR)

MethodDescription
SetGDPR(bool state)Sets the user’s consent status (true = consent given).
GetGDPRState()Returns the current consent status.

Events

Subscribe to these events to react to ad lifecycle changes.

// Global Ad Lifecycle
AdsManager.AdLoaded += (provider, type) => Debug.Log($"{type} Loaded");
AdsManager.AdDisplayed += (provider, type) => Debug.Log($"{type} Displayed");
AdsManager.AdClosed += (provider, type) => Debug.Log($"{type} Closed");

// Banner Specific
AdsManager.BannerShown += () => Debug.Log("Banner UI Visible");
AdsManager.BannerHidden += () => Debug.Log("Banner UI Hidden");

// Status Changes
AdsManager.ForcedAdDisabled += () => Debug.Log("Ads Removed via IAP");

// Custom Logic Conditions
// Return false to prevent interstitials (e.g., during tutorials or loading)
AdsManager.InterstitialConditions += () => {
    return !TutorialManager.IsActive;
};