Everything you need ships with the package:
- 📋 Quick Implementation Checklist – 15‑minute fast start
- 📖 Comprehensive Implementation Guide – Architecture deep dive
- 🛡️ GDPR Consent Management Guide – Full Google UMP flow
- ✅ Google Certified CMP Integration – Enterprise consent solutions
💡 Quick Start: Add the package via Unity Package Manager (Git URL), import the Prefabs sample, press Play.
A production-ready AdMob + Unity Ads mediation stack for Unity projects. It provides thread-safe ad orchestration, direct Google UMP ➜ Unity Ads consent mirroring, AES-secured “Remove Ads” persistence, and developer-friendly diagnostics.
- 🧠 Thread-Safe Ad Orchestration –
AdsManagercaptures Unity’s sync context, enforces main-thread access, auto-instantiates when missing, and guards every show call against overlaps. - 🛡️ Consent-Aware Mediation –
ConsentManagerruns the full Google UMP async flow, whileMediationConsentManagermaps user selections into Unity Ads metadata (gdpr.consent, privacy.mode, tracking, age flags). - 💾 Secure Remove Ads Persistence –
AdPersistenceManagerstores purchases through AES-256 + HMAC (SecureStorage), includes legacy migration helpers, and exposes load/save events for cloud sync. - 🎯 Complete Ad Coverage – Dedicated controllers handle Banner, Interstitial, Rewarded, Rewarded Interstitial, and App Open inventory with adaptive + collapsible banner support.
- 🧪 Developer Tooling – Rich logging, consent diagnostics, context-menu shortcuts, and sample UIs (
VerifyAdmob,AdsExampleUI,ConsentUIExample) accelerate integration and testing.
- 🔄 All Ad Formats – Banner, Interstitial, Rewarded, Rewarded Interstitial, App Open controllers with unified retry logic
- 🎯 Unity Ads Mediation – Consent-aware metadata updates with a single call
- 📱 Adaptive Banners – Anchored adaptive requests sized per device
- 🎨 Collapsible Banners – Edge-aware collapsible extras for banner experiments
- Smart Filtering – Banner, Interstitial, and App Open automatically disabled when Remove Ads is active
- Rewarded Preservation – Rewarded formats stay available to keep monetization paths open
- Performance Savings – Controllers skip load attempts for disabled formats
- IAP Ready – Direct setters, events, and persistence hooks for purchase flows
- AES-256 Secure Storage – Encrypted + HMAC-verified persistence via
SecureStorage - Cloud Sync Friendly – Events fire when values change or load, enabling cross-device propagation
- Legacy Migration – Manual XOR migration helpers protect older installs
- Automatic Management – Load/save on startup with manual overrides when needed
- Inspector Friendly –
VerifyAdmobexposes all knobs without code edits - Runtime Mutations – Update IDs, banner options, or toggles at runtime
- Platform Awareness –
AdConfigurationhandles Android/iOS switching automatically - Validation Tools – Built-ins check for empty IDs or lingering Google test units
- Sample UI Suite –
AdsExampleUIincludes buttons for every show path and status indicator - Context Menu Shortcuts – Right-click scripts to toggle Remove Ads, refresh consent, clear storage
- Verbose Logging – Consent, initialization, and controller state changes are fully logged
- Status Helpers –
AdsManager.LogDebugStatus()surfaces key toggles and readiness flags
- Dynamic Button States – Sample UI toggles interactability based on readiness checks
- Visual Remove Ads Indicator – Color-coded buttons reflect Remove Ads state
- Professional Log Panel – Hook
TMP_Textto mirror debug events in-game - Smart Banner Control – First-load tracking ensures banners appear only after consent
AdsManager– Singleton orchestrator, synchronization context guard, lifecycle managerVerifyAdmob– Scene entry point for configuration + initializationAdConfiguration– Centralized ad unit IDs and global toggles- Ad Controllers –
BannerAdController,InterstitialAdController,RewardedAdController,RewardedInterstitialAdController,AppOpenAdController ConsentManager– Google UMP integration with async flowsMediationConsentManager– Unity Ads metadata bridgeAdPersistenceManager– Remove Ads persistence coordinatorSecureStorage– AES-256 + HMAC secure storage utility- Samples –
AdsExampleUI,ConsentUIExample, and supporting prefabs for rapid testing
All runtime scripts live in the Autech.Admob namespace.
// Event-based logging system with UI integration
// Assign a TMP_Text component to debugLogText in AdsExampleUI
AdsExampleUI.OnDebugLog += message => Debug.Log($"Ads Debug: {message}");
AdsExampleUI.OnDebugLog?.Invoke("Custom log message");
// Check current ad system status
AdsManager.Instance.LogDebugStatus();// Set platform-specific Ad Unit IDs at runtime
AdsManager.Instance.SetAndroidAdIds(
"ca-app-pub-YOUR_ID/banner",
"ca-app-pub-YOUR_ID/interstitial",
"ca-app-pub-YOUR_ID/rewarded",
"ca-app-pub-YOUR_ID/rewarded_interstitial",
"ca-app-pub-YOUR_ID/app_open"
);
AdsManager.Instance.SetIosAdIds(
"ca-app-pub-YOUR_ID/banner",
"ca-app-pub-YOUR_ID/interstitial",
"ca-app-pub-YOUR_ID/rewarded",
"ca-app-pub-YOUR_ID/rewarded_interstitial",
"ca-app-pub-YOUR_ID/app_open"
);
bool isValid = AdsManager.Instance.AreAdIdsValid();
bool isTestMode = AdsManager.Instance.AreTestAdIds();
AdsManager.Instance.LogCurrentAdIds();AdsExampleUI testUI = FindObjectOfType<AdsExampleUI>();
testUI.TestAllAdsSequentially(); // Run full suite
testUI.TestRemoveAdsFunctionality(); // Walk Remove Ads workflow
testUI.CheckAllAdStatus(); // Log readiness for every format
testUI.CheckAdIds(); // Validate configuration
testUI.CallInterstitial(2);
testUI.CallRewarded(3);
testUI.CallRewardedInterstitial(3);
testUI.CallAppOpen(2);
testUI.ToggleBannerTestCall();AdsManager.Instance.ShowRewarded(
onRewarded: reward => {
Debug.Log($"Reward granted: {reward.Amount} {reward.Type}");
// Grant your in-game reward here
},
onSuccess: () => Debug.Log("Rewarded ad finished"),
onFailure: () => Debug.Log("Rewarded ad unavailable")
);
// Simplified helpers
AdsManager.Instance.ShowRewarded();
AdsManager.Instance.ShowRewarded(OnRewardedClosed);
AdsManager.Instance.ShowRewarded(OnRewardedClosed, OnRewardedFailed);- Unity 2020.3 or higher
- Google Mobile Ads Unity SDK 10.6.0+
- Git installed (for Package Manager Git URL import)
⚠️ IMPORTANT: Install Google Mobile Ads (GMA) and External Dependency Manager before adding this package.
Need visuals? See INSTALL.md for step-by-step screenshots.
- Open
Window > Package Manager - Click
+→ Add package from git URL… - Paste
https://github.com/HaseebDev/Admob-Mediation-Package.git - Click Add
Ensure the following packages exist (via Package Manager or Packages/manifest.json):
com.google.ads.mobile(Google Mobile Ads, 10.6.0+ recommended)com.google.ads.mobile.mediation.unity(Unity Ads mediation adapter)com.google.external-dependency-manager(EDM4U)
💡 The package now detects these dependencies on import and can auto-install them from the official Google repository after a quick confirmation dialog. You can rerun the installer anytime via
Tools ▸ Autech ▸ Install Google Dependencies.
npm install -g openupm-cli
cd your-unity-project
openupm add com.google.ads.mobile
openupm add com.google.ads.mobile.mediation.unityFinish by adding this package via Git URL as shown above.
- Configure AdMob →
Assets > Google Mobile Ads > Settings - Import Prefabs Sample → Package Manager → Samples → Import
- Add to Scene → Drag
Samples/Prefabs/VerifyandInitializeAdmobprefab - Configure → Set ad unit IDs, consent toggles, Remove Ads defaults
- Press Play → Use the sample UI to validate every ad path
“Package cannot be found” – Install the GMA and EDM packages first, then retry the Git URL import.
“No meta file” console warnings – Harmless; scripts live under Packages/com.autech.admob-mediation/Runtime/.
Dependencies missing – Open Packages/manifest.json to confirm the dependency entries.
Unity Ads mediation not respecting consent – After UMP completes, call AdsManager.Instance.RefreshMediationConsent().
Remove Ads not persisting – Verify encryption key consistency and confirm AdPersistenceManager.UseEncryptedStorage matches your expectations.
Ads not loading – Double-check ad unit IDs, network connectivity, and test vs production settings.
Need more help? – See INSTALL.md and KNOWN_ISSUES.md.
| Version | Release Date | Key Features |
|---|---|---|
| v2.1.1 | Latest | Repo now tracks Assets package sources, Runtime synced with latest consent + iOS helpers, documentation refreshed for 2.1.1 rollout |
| v2.1.0 | Previous | Thread-safe AdsManager, AES-secured persistence, Google UMP ➜ Unity Ads consent bridge, unified controller retries, refreshed tooling & docs |
| v2.0.2 | Previous | Enhanced UI integration, visual Remove Ads indicator, smart banner visibility control, professional debug logging |
| v2.0.1 | Previous | Remove Ads system, persistence, comprehensive testing |
| v2.0.0 | Legacy | Adaptive banners, collapsible support, revenue tracking |
| v1.0.0 | Initial release | Basic ad integration |
- Use
VerifyAdmobin the Inspector for quick edits. - Call
AdsManager.Instance.SetAllAdIds(...)at runtime to refresh everything in one hit. - Run
AdsManager.Instance.AreAdIdsValid()orAdsManager.Instance.AreTestAdIds()before production builds.
- Confirm
AdsManager.Instance.RemoveAdsupdates the UI viaAdsManager.OnRemoveAdsChanged. - Persist purchases by calling
AdsManager.Instance.ForceSaveToStorage()after IAP success. - Restore purchases with
AdsManager.Instance.ForceLoadFromStorage()on startup.
- Configure debug geography and consent debugging in
VerifyAdmob. - Trigger
AdsManager.Instance.ShowPrivacyOptionsForm()from your settings menu. - Refresh mediation metadata whenever the consent state changes.
To test GDPR/EEA consent forms outside Europe, you need to configure your device as a test device:
- Enable ForceEEA in
VerifyAdmobInspector (Consent Configuration section) - Run your app (without any hash IDs configured first)
- Check logs for UMP SDK message:
- Android (Logcat/Unity Console):
Use new ConsentDebugSettings.Builder().addTestDeviceHashedId("YOUR_HASH_HERE") - iOS (Xcode Console):
<UMP SDK>To enable debug mode for this device, set: UMPDebugSettings.testDeviceIdentifiers = @[YOUR_HASH_HERE]
- Android (Logcat/Unity Console):
- Copy the hash ID from the log message
Open Runtime/Scripts/ConsentManager.cs (line ~50):
private static readonly string[] DefaultDebugDeviceHashedIds =
{
"YOUR_COPIED_HASH_ID_HERE", // Your device
"ANOTHER_DEVICE_HASH", // Team member's device
};- Rebuild your app
- ForceEEA will now work correctly
- You'll see the EEA consent form even outside Europe
⚠️ IMPORTANT: Google does NOT expose the hash algorithm. You MUST get the hash ID from UMP SDK logs. Do NOT try to calculate it from GAID/IDFA.
🔒 Production: Remove test device hash IDs and disable
ForceEEAGeographyForTestingbefore publishing.
The VerifyAdmob component is OPTIONAL - it's a convenience wrapper for quick prototyping:
// Attach VerifyAdmob to a GameObject
// Configure everything in Inspector
// Automatically initializes AdsManagerusing Autech.Admob;
public class MyAdsInitializer : MonoBehaviour
{
async void Start()
{
// Configure settings
var settings = new AdsManager.AdsManagerSettings
{
ForceEEAGeographyForTesting = false, // Production: false
EnableConsentDebugging = false, // Production: false
AlwaysRequestConsentUpdate = true, // Google recommends: true
TagForUnderAgeOfConsent = false, // COPPA: Set true if targeting kids
EnableTestAds = false, // Production: false
// Ad Unit IDs
AndroidBannerId = "ca-app-pub-YOUR_ID/banner",
AndroidInterstitialId = "ca-app-pub-YOUR_ID/interstitial",
// ... set other IDs
};
// Apply configuration
AdsManager.Instance.ApplyConfiguration(settings);
// Initialize
await AdsManager.Instance.InitializeAsync();
// Show banner
AdsManager.Instance.ShowBanner(true);
}
}Benefits of Direct Setup:
- Full programmatic control
- Runtime configuration
- No prefab dependencies
- Easier integration with existing systems
Benefits of VerifyAdmob:
- Inspector-based configuration
- No code required
- Quick prototyping
- Built-in validation helpers
Right-click the component in the Inspector:
- VerifyAdmob – Toggle Remove Ads, validate IDs, refresh consent metadata
- AdsExampleUI – Run sequential ad tests, check status, clear logs
- AdsManager – Force load/save, clear Remove Ads data, print debug status
AdsExampleUI testUI = FindObjectOfType<AdsExampleUI>();
testUI.TestAllAdsSequentially();
testUI.TestRemoveAdsFunctionality();
testUI.CheckAllAdStatus();
testUI.CheckAdIds();
testUI.ClearDebugLog();
AdsManager.Instance.LogDebugStatus();- 📦 Unity Package Manager registry publishing
- 🎨 Built-in UI widgets with Remove Ads awareness
- 📊 Analytics hooks (Firebase / Unity Analytics) with ad revenue tracking
- 🔔 Notification-ready consent prompts
- 🏪 Expanded IAP helper utilities
- 🌐 Advanced multi-device sync tooling
- Open an Issue
- Submit a Pull Request
- Check the CHANGELOG for detailed history
This project is licensed under the MIT License – see the LICENSE file.
⭐ Star this repo if it helps your next project!
Made with ❤️ by Autech