For AI agents: the complete documentation index is available at /AchEngine/en/llms.txt, the full documentation bundle is available at /AchEngine/en/llms-full.txt, and this page is available as Markdown at /AchEngine/en/usage/managers/ads.md.

AdsManager

AdsManager uses Unity Ads Legacy 4.16.4 as its default provider for interstitial, rewarded, and banner ads. com.unity.ads is an AchEngine 1.3.2 dependency, so Unity's Package Manager resolves it with the package. AchManagerInstaller registers AdsManager.

Live ads require the Android/iOS game IDs and ad-unit IDs from Unity Dashboard. The Editor uses the Android game ID; configure it as well. Keep testMode enabled only during development.

Quick setup

Configure the manager once before initialization in your bootstrap. With VContainer, apply the same calls to an injected AdsManager.

var ads = ServiceLocator.Resolve<AdsManager>();

ads.Configure(new AdsConfiguration(
    androidGameId: "Android game ID",
    iosGameId: "iOS game ID",
    interstitialAdUnitId: "Interstitial_Android",
    rewardedAdUnitId: "Rewarded_Android",
    bannerAdUnitId: "Banner_Android",
    testMode: true));

ads.InitializationFailed += message => Debug.LogError(message);

await ads.Initialize();
await ads.LoadInterstitialAsync();
await ads.LoadRewardedAsync();

If Android and iOS use different ad-unit IDs, create the appropriate AdsConfiguration in each platform bootstrap. Configure() can only run before initialization begins.

Interstitial and rewarded ads

Load an ad before showing it, then reload every fullscreen ad after a show attempt. Grant a reward only when ShouldGrantReward is true; skipped or failed rewarded ads must grant nothing.

var result = await ads.ShowRewardedAsync();

if (result.ShouldGrantReward)
    GrantCoinsToPlayer();
else if (!result.IsSuccess)
    Debug.LogWarning(result.Message);

await ads.LoadRewardedAsync();

The Unity Ads provider shows banners at bottom center. A successful ShowBannerAsync() means the request reached the SDK, not that it produced an impression.

await ads.LoadBannerAsync();
await ads.ShowBannerAsync();
ads.HideBanner();

Mediation

The default provider is a small Unity Ads Legacy integration. For new live operations and competition among multiple networks, use one of these mediation products:

OptionBest fitAchEngine integration
Unity LevelPlayUnity Ads-centered operations and Unity's current mediation stackWrap the LevelPlay SDK in IAdsProvider.
AppLovin MAXAdvanced monetization/bidding tools and broad network operationsImplement a MAX Unity SDK IAdsProvider.
Google AdMob / Google Ad ManagerExisting Google ads, Firebase, or GAM reporting stackWrap the AdMob Unity SDK and its currently supported Unity Ads network adapter.
Digital Turbine FairBid and similarExisting agreement or tooling with that providerWrap that provider's Unity SDK in the same interface.

Adapter availability, bidding support, minimum Android/iOS SDK versions, and privacy/ATT requirements change frequently. Before integrating, confirm the selected mediator's current Unity Ads adapter and platform requirements.

// Replace the default provider with an adapter around a mediation SDK.
var ads = AdsManager.Create(new MyLevelPlayAdsProvider());

IAdsProvider contains only initialization, load/show, and banner-hide operations. The adapter must map its callbacks to AdsLoadResult/AdsShowResult and return Completed only after a rewarded ad finishes. Do not initialize a Legacy Unity Ads provider and LevelPlay together in the same app session.

API

MemberDescription
Configure(configuration)Sets game IDs and ad-unit IDs before initialization.
Initialize()Initializes the provider with the active platform game ID.
LoadInterstitialAsync() / LoadRewardedAsync() / LoadBannerAsync()Loads an ad for display.
ShowInterstitialAsync() / ShowRewardedAsync() / ShowBannerAsync()Shows a loaded ad and returns its result.
HideBanner()Hides the active banner.
IsLoaded(placement)Checks display readiness for an ad placement.
AdsShowResult.ShouldGrantRewardTrue only for a completed rewarded ad.