tea-x-random/unity-game-skills/unity-monetization

Claude Code and agent skill by tea-x-random/unity-game-skills

Trust tier 3
  • community
  • ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Source check pending

Checking that the SKILL.md file is still in the repository.

Integrate ads and monetization into Unity 6 iOS games. Use for Google AdMob/GoogleMobileAds, Unity Ads, interstitials, rewarded ads, test units/TestFlight, frequency caps and cadence policies, natural-break placements, SDK-agnostic facades, LevelPlay/AppLovin MAX mediation decisions, OpenUPM, asmdef/DLL references, EDM4U/CocoaPods, cloudProjectId, ATT/NSUserTrackingUsageDescription, SKAdNetworkItems, non-personalized ads, pending-approval/no-fill, or INTERNAL_ERROR setup failures. Covers initialization, load/show callbacks, main-thread marshalling, per-platform IDs, post-build plist work and unit-testable count-or-time ad policy. Pair with analytics/liveops to tune retention and ARPDAU.

Install

npx vskill@latest install tea-x-random/unity-game-skills/unity-monetization

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as tea-x-random/unity-game-skills/unity-monetization.

Unity Monetization

Wire ads into a casual iOS game without breaking the build or lying about whether ads serve. The deliverable is an AdsManager that no-ops safely off-device (behind an SDK-agnostic Ads facade), WHEN-to-show factored into a pure unit-tested cadence policy, and a build that carries whatever provisioning the SDK needs — plus an honest statement of what is provisioned vs coded. Built on unity-mcp-bridge (Editor actions) and cross-linked to unity-qa-release (the CocoaPods / pod-install / .xcworkspace build mechanics).

The path we ship now is Google AdMob (com.google.ads.mobile via OpenUPM) — see "Google AdMob (iOS)" below. The Unity Ads direct material that follows is still proven and kept as the alternative path (and as the source of the INTERNAL_ERROR / LevelPlay-conflict lore).

Doctrine (these override convenience)

  1. "Code compiles" ≠ "ads serve." Never claim ads work without seeing one render on-device. A clean build, a valid Game ID, and green listeners prove nothing about delivery. The only proof is an ad frame on a real device (or TestFlight). Until then say "integration wired, delivery unverified."
  2. A brand-new ad account/app/unit is almost certainly NOT serving real ads yet. Freshly created Unity Ads / AppLovin / ironSource accounts sit in "pending approval". AdMob is the same in a sharper form: a new AdMob app/unit returns no-fill for real ads until Google approves the app (often only once it's live / linked to a store listing) and the unit warms up (hours to a couple days). Flipping UseTestAds true→false too early makes ads disappear — that's expected, not a bug. Google test unit IDs always serve regardless of approval. When a valid ID yields no ad, suspect provisioning/no-fill first, not C#. Code must handle no-fill gracefully (log + retry next opportunity, never block gameplay).
  3. Pick ONE ad path. Mixing leaves conflicting CocoaPods. We evaluated three in one project; friction order was LevelPlay (com.unity.services.levelplay, mediation, account pending) → AppLovin MAX (.unitypackage, account pending) → Unity Ads direct (com.unity.ads), which is the path we shipped on. Two SDKs pulling the same pod at different versions breaks pod install (see the LevelPlay trap below).
  4. The iOS Xcode project is REGENERATED every build. Anything you'd hand-edit in Xcode (Info.plist ATT/SKAdNetwork keys, entitlements) must be re-applied by a [PostProcessBuild] editor script, or it's gone next build. Never hand-edit the generated project.
  5. Bootstrap ads on device only, and no-op until configured. The manager must do nothing in the Editor / off-device and nothing until a real Game ID + placement exist, so the rest of the game (and tests) never depends on an ad SDK being present or reachable.
  6. Gameplay never references the ad SDK — go through a tiny `Ads` facade. A static facade (Ads.NotifyGameFinished() → Ads.GameFinishedHandler?.Invoke()) that the concrete AdsManager registers at launch keeps gameplay assemblies SDK-free and makes swapping ad networks a one-file change. Off-device the handler is null → no-op. (The reference project swapped Unity Ads → AdMob by rewriting only AdsManager.cs.)
  7. WHEN to show is a pure, unit-tested policy — not logic buried in the MonoBehaviour. Put frequency capping in an engine-free class with injected time so it's deterministic and testable; the MonoBehaviour owns the real clock + SDK. Separate the decision from the commit (MarkShown only on real display) so a not-yet-loaded ad doesn't reset the counters.

Confirm the Editor is reachable (mcpforunity://editor/state, ready_for_tools==true) before driving any of this through MCP; for the CocoaPods build itself, route to unity-qa-release.

2025-2026 casual monetization strategy (hybrid by default)

The single-network mechanics below are still how you wire ads — but the strategy they serve has consolidated. For casual / hybrid-casual on iOS, hybrid monetization (IAP + ads) is now the default, not an upsell: ~72%+ of developers run both, because only ~1.8% of F2P players ever make an IAP — so ads monetize the ~98% who never pay, while IAP (including a "remove ads" purchase) monetizes the rest. A typical mature mix lands around ~40-50% IAP / ~50-60% ads (game growth advisor, gamigion hybrid-casual overview). Plan for both revenue streams from the start; a pure-ads or pure-IAP casual game is leaving most of the table.

  • Rewarded video is the core casual ad format — and the highest-eCPM format (Rewarded > Interstitial > others). Design natural rewarded placements players opt into: continue/revive, double-coins, free-spin (TopOn 2025 H1 report). The injectable-time cadence policy below generalizes to rewarded triggers too.
  • More ads ≠ more revenue. Over-serving hurts both retention and eCPM, so don't chase a fixed cadence number — tune frequency by measuring ARPDAU and retention, not by a hardcoded cadence (tap-nation KPIs). Cross-reference unity-analytics-liveops for ARPDAU, retention funnels, and remote-config-driven ad-cadence A/B tests.
  • Mediation reality (context for the LevelPlay vs MAX vs direct decision below). AppLovin MAX dominates ad mediation — ~73% of top-downloaded games and ~55% of top-grossing; LevelPlay/ironSource is more competitive on grossing (~25%) than on downloads; AdMob sits ~11-13% (gamebiz consulting newsletter). This doesn't override our friction-ordered pick (we shipped Unity Ads direct, AdMob now) — it's the market backdrop: MAX is where most of the ecosystem optimizes fill/eCPM.
  • ATT shifted ad revenue toward Android; measure iOS without IDFA. Post-ATT, iOS is now ~43% of mobile-game ad revenue vs Android ~57%, and iOS attribution must rely on SKAdNetwork / AdAttributionKit, not IDFA (Tenjin 2026 ad-mon report). This is why the non-personalized / no-ATT posture below is viable, and why the SKAdNetwork plist work is load-bearing rather than optional.

Google AdMob (iOS) — the path we ship now

GMA com.google.ads.mobile 11.2.0 (Unity 6000.5.0f1, built-in pipeline). Full annotated integration in references/admob-ios.md; the load-bearing gotchas:

  • Install via OpenUPM. Add a scoped registry package.openupm.com (https://package.openupm.com) with scopes com.google.ads.mobile + com.google.external-dependency-manager, then add "com.google.ads.mobile": "11.2.0" and "com.google.external-dependency-manager": "1.2.187" to dependencies. Resolution needs the Editor focused to process the manifest change and can drop/timeout the MCP bridge — reconnect by clicking the Editor.
  • The GMA runtime is PRECOMPILED DLLs, not an asmdef. GoogleMobileAds.dll, .Core.dll, .Common.dll, etc.; the only asmdef is GoogleMobileAds.Editor (editor code). So you cannot put "GoogleMobileAds" in your asmdef's references array (that's for other asmdefs — it warns "unresolved reference"). With overrideReferences:false (the default) the auto-referenced DLLs resolve on their own — the fix is to remove the bad reference, and using GoogleMobileAds.Api; compiles. (YourGame.Game.asmdef references only YourGame.Core + Unity.TextMeshPro.)
  • Marshal v11 callbacks yourself. MobileAds.RaiseAdEventsOnUnityMainThread is obsolete in v11 (works, but warns). Instead wrap each callback body — Load completion, OnAdFullScreenContentClosed, OnAdFullScreenContentFailed (all arrive on a background thread) — in GoogleMobileAds.Common.MobileAdsEventExecutor.ExecuteInUpdate(() => { ... }). The executor is initialized during MobileAds.Initialize, so marshal inside the Initialize callback too.
  • App ID + ATT string via the settings asset; GMA writes the plist. Set GoogleMobileAdsIOSAppId (serialized adMobIOSAppId, e.g. ca-app-pub-XXXX~YYYY) in Assets/GoogleMobileAds/Resources/GoogleMobileAdsSettings.asset (a GoogleMobileAds.Editor.GoogleMobileAdsSettings ScriptableObject). GMA's iOS post-processor then writes GADApplicationIdentifier, NSUserTrackingUsageDescription (only if set), and ~50 `SKAdNetworkItems` into the built Info.plist — your own `[PostProcessBuild]` must NOT touch those keys (no collision; contrast Unity Ads, where you write SKAdNetwork yourself). There's no LoadInstance(); create the asset by reflection (ScriptableObject.CreateInstance(type) → AssetDatabase.CreateAsset → set props → save).
  • Non-personalized ads = simplest privacy posture. var req = new AdRequest(); req.Extras.Add("npa", "1"); Do NOT request ATT; clear UserTrackingUsageDescription so NSUserTrackingUsageDescription isn't written (the reference project also strips it defensively in PostBuild.cs). No ATT prompt → declare "no tracking" in the privacy manifest + App Privacy questionnaire. Most users decline ATT anyway, so personalization uplift is small for a casual game and the review path is much simpler.
  • iOS pods via EDM4U. GoogleMobileAdsDependencies.xml → Google-Mobile-Ads-SDK ~> 13.4; GoogleUmpDependencies.xml → GoogleUserMessagingPlatform 3.1.0. EDM4U writes both into Build/iOS/Podfile; the env-stripped pod install + .xcworkspace build lives in unity-qa-release › fastlane/CocoaPods.
  • No-fill is normal pre-launch — see Doctrine 2. Keep UseTestAds=true (or register an AdMob test device) for TestFlight QA; Google's iOS test interstitial is ca-app-pub-3940256099942544/4411468910.

Shipped files: Assets/<YourGame>/Scripts/Game/Net/Ads.cs (facade), .../Net/AdsManager.cs (AdMob backend, added by AppRoot), Assets/<YourGame>/Scripts/Core/AdCadence.cs (cadence) + Tests/EditMode/AdCadenceTests.cs.

Ad cadence as a pure, testable policy

Factor WHEN-to-show out of the SDK shell into an engine-free policy class (YourGame.Core/AdCadence.cs, 19 green EditMode tests). Full detail in references/ad-cadence-policy.md:

  • Dual OR trigger: show when (games-since-last-ad ≥ N) OR (seconds-since-last-ad-or-app-open ≥ T) — count monetizes quick back-to-back games, time monetizes one long session. Example values: GamesPerAd=2, MinSessionGapSeconds=300 (inclusive boundary). These are starting points, not gospel: the right cadence is the one your ARPDAU-vs-retention data supports, tuned via remote-config A/B — not a hardcoded number (see unity-analytics-liveops).
  • Injected time: the policy takes now (seconds) as an argument; the MonoBehaviour supplies Time.realtimeSinceStartupAsDouble. Fully deterministic → plain unit tests, no Play Mode / SDK.
  • Decision vs commit: RegisterGameFinishedAndShouldShow(now) decides; MarkShown(now) resets both triggers and is called only when an ad actually displays. If the ad isn't loaded you skip MarkShown, so the "owed ad" shows as soon as one is ready (counter keeps climbing). MarkAppOpen(now) resets only the time baseline. Promote this "pure injectable-time policy + thin SDK shell" as the default for frequency capping — it generalizes to rewarded/banner cadence.

Alternative path: Unity Ads direct (com.unity.ads)

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
3
7-day trend score
7

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Extension points

  • hookPre/post lifecycle hooks

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/tea-x-random/unity-game-skills/unity-monetization/badge)](https://verified-skill.com/skills/tea-x-random/unity-game-skills/unity-monetization)

Something wrong with this skill or its page? Tell us.