How it works
Design
How Intermission is built, and the facts about Unity’s SDKs it rests on.
Every SDK fact below was read from the libraries on Maven Central (mediation-sdk 9.8.0, unityads-adapter 5.17.0, unity-ads 4.22.0), with javap, not from Unity’s documentation.
Shape
plugin/is one Android library: a Godot 4.7 Android plugin (v2) namedIntermissionAndroid. It compiles against LevelPlay but does not bundle it, and the game’s Gradle build fetches the SDKs.IntermissionPluginis the only public class: the methods Godot calls and the signals it declares.AdControllerkeeps the state of every ad unit and decides every signal, with no Android or SDK code in it, so the unit tests drive it with a fake provider, a fake clock and a fake banner layer.LevelPlayProvideris the only code that touches LevelPlay, behind theProviderinterface.BannerLayeris a view over the game that holds the banner and lets every other touch through.
demo/addons/intermission/is the addon:intermission.gd(the typedIntermissionclass) and the export plugin, which adds the library and the SDKs’ Maven coordinates to a Gradle build.demo/is a project that tries every call on a phone, anddemo/tests/checks the addon headless against a stand-in for the Android singleton and against the Kotlin source.
Threads
- Godot calls the plugin on its own thread. Each call is posted to the Android main thread, where the SDK and the controller run, in the order it was made.
- Only
isAdReady,isInitialized,isTestModeandsdkVersionanswer at once, from values the controller publishes for other threads. - Signals go through Godot’s
emitSignal, which delivers them on Godot’s thread. While a full-screen ad covers the game, Godot is paused and the signals wait, in order, until it resumes.
The SDK facts it rests on
- Classes and listeners:
LevelPlay.init(Context, LevelPlayInitRequest, LevelPlayInitListener),LevelPlayInterstitialAdandLevelPlayRewardedAd(loadAd,isAdReady,showAd(Activity, String?),setListener), andLevelPlayBannerAdView(Context, String, Config)withpauseAutoRefresh,resumeAutoRefreshanddestroy. Banner listeners take(adInfo, error)for a failed display, while the full-screen ones take(error, adInfo). - Banner sizes:
LevelPlayAdSize.BANNERis 320x50,LARGE320x90,MEDIUM_RECTANGLE300x250 andLEADERBOARD728x90, andcreateAdaptiveAdSize(Context)makes the adaptive size. - Consent:
LevelPlayPrivacySettings.setGDPRConsent,setCCPAandsetCOPPA. The Unity Ads adapter passes them on as Unity’sgdpr.consent,privacy.consentanduser.nonBehavioral. - No test mode in code: the adapter builds Unity’s
InitializationConfigurationwithwithTestMode(false), always. So the plugin’s test mode asks LevelPlay’s public demo app (DemoApp.kt, from Unity’s own demo) for every ad. A game’s own account then never sees a test device, which is what Unity’s fraud checks watch. - Registering a test device is not enough: LevelPlay sends a network’s test ads to a device only when the device is added under Test devices and that network, with its ad units, is chosen for it with “Test ads”, and “by default, the ad network configuration resets within the hour” (Unity’s integration testing guide). The Integration Test Suite has a Live / Test toggle for bidding networks (Unity’s test suite guide). On 21 Nov 2026 a phone registered as a test device, without Unity Ads chosen for it with “Test ads”, got two live third-party campaigns through LevelPlay bidding with a game’s own app key, the second after Unity’s “Force test mode ON for all devices” override was saved. The missing “Test ads” choice is the most likely reason. So the safe rule stands: never show a game’s own ads on your own phone. The plugin’s test mode is for showing ads, and a game’s own ad units are checked with loads only.
- Test suite: LevelPlay reads the
is_test_suitemetadata at init, so the plugin sets it beforeinitin debug builds and in test mode, andlaunchTestSuiteopens the suite after. - Bidding only: the adapter loads Unity Ads with
LoadConfiguration.Builder(placement).withAdMarkup(...), the bid from LevelPlay’s auction. Unity’s bidding placements cannot be loaded without that markup, and new waterfall placements can no longer be created, which is why the plugin goes through LevelPlay and not the Unity Ads SDK alone. - Errors: LevelPlay’s codes are int constants in
LevelPlayAdError(624 to 631) andcom.ironsource.mediationsdk.logger.IronSourceError.LevelPlayErrors.ktmaps the common ones (no fill, no connection, capped, timeout, expired) toAdError, and the rest stayPROVIDERwith the raw code. - No expiry callback: LevelPlay never says that a loaded ad expired.
showasks the SDK’sisAdReadyfirst and reportsEXPIREDwhen the ad is gone. - Rewards can trail the close: the plugin waits up to a second after a rewarded close for
onAdRewarded, soad_closed(rewarded)is right. - Banners skip refreshes while invisible (codes 613 and 623), so the layer shows the banner’s holder whenever the game wants a banner. Until it loads it is empty and lets touches through.
- Version ranges: the mediation-sdk POM asks for
adquality-sdk [9.12.0,10.0.0), and unity-ads asks forcoherencelib [0.3.0,0.4.0). The export plugin holds both strictly (9.12.1!!,0.3.0!!). - Code that runs without
initialize: the merged manifest gets two LevelPlay content providers (IronsourceLifecycleProvider,LevelPlayActivityLifecycleProvider) and Unity’sandroidx.startupinitializerAdsSdkInitializer. They start with the app, even when a game never initializes the plugin. - Permissions: the SDKs’ manifests add
INTERNET,ACCESS_NETWORK_STATE,AD_ID,ACCESS_ADSERVICES_ATTRIBUTIONandACCESS_ADSERVICES_TOPICS. A game may remove the last two in its own manifest.
Ads that misbehave
app_left: the plugin tracks every resumed activity of the app, the ads’ own full-screen activities included. When none has been in front for half a second while a full-screen ad is up, something outside the app covered the ad, and the plugin reports it once for that ad, with whether a tap came first. Resumed, not started, activities count, because Google Play’s install overlay is see-through and leaves the ad’s activity started. On a test phone a Unity Ads test interstitial opened that overlay by itself about 10 seconds in, with no touch (Unity’s WebView calledopenUrl("https://play.google.com/d?id=...", overlay: true)), and LevelPlay reported no click. Counting started activities missed it, and counting resumed ones catches it. No switch turns this off in code: Unity Ads 4.22.0’sAndroidHandleOpenUrlstarts whatever intent the ad’s own script asks for through the WebView bridge, and neither SDK’s classes mentionoverlay,autoOpen,storeOverlayorinlineInstall. For banners it uses LevelPlay’sonAdLeftApplication, and a tap in the 5 seconds before counts.ad_overlong: off until a game sets a limit, since how long is too long depends on the game. Once set, a timer starts when a full-screen ad shows and fires once if the ad is still up at the limit.- An ad that neither shows nor fails within 8 seconds of
showis given up withTIMEOUT, so one stuck ad never blocks the next.
Choices that keep the API small
- One provider, LevelPlay, built into the one library, with no provider setting or second library to pick.
- The reward is the
rewardedflag onad_closed, not a signal of its own, so a game grants it in one place. The reward’s name and amount from the dashboard are left out, since a game knows what it gives. - Banners sit centred at the top or the bottom with a margin, and their size comes with
banner_loaded. open_test_suiteneeds no setup call, since the plugin enables the suite in debug builds and test mode.
Changes from the first design
The first design (written before the SDK was chosen) planned Unity Ads alone with placements. The real SDK changed these:
- LevelPlay is the provider, since Unity’s bidding placements need a mediator.
- Ad unit ids replace placement ids, and an optional placement name goes with
show_adandload_banner. ad_closed(rewarded)replacesad_finished(completed), since LevelPlay reports a close and a reward, not a finish state.- There is no
ad_expiredsignal (see above). load_ad,show_adandis_ad_readyavoid GDScript’s ownload.AdErroravoids shadowing Godot’s globalError.- The singleton is
IntermissionAndroid, apart from the GDScript classIntermission. app_leftcounts the app’s resumed activities rather than watching the game’s own pause, as explained above.
Device checklist
Run on a phone in test mode only, never tapping a live ad:
- Initialize:
initialized(true)online, and a clear failure offline. - Interstitial: loads, shows, closes with its close button,
ad_closedonce, and the game resumes where it was. Unity’s ad player ignores Back, during the video and on the end card. - Rewarded: watched to the end,
ad_closed(rewarded = true)once. - Banner: loads, shows at the top and the bottom with a margin, hides, comes back, and touches beside it reach the game.
- An ad that opens the store without a tap raises
app_left(clicked = false), and a normal show and close raises nothing. - Home during an ad, then back: the game resumes and the ad state is right.
- Rotation keeps the banner and the log.
- Logcat shows no errors from
studio.chaosmos.intermissionand no “Invalid type” or “not registered” warnings fromGodotPlugin.
Intermission is an open source Godot plugin under the MIT licence, one of the toolsmade by Chaosmos. It is not sponsored by or affiliated with Unity Technologies or the Godot Foundation.