UmpConsentController
Overview
Handles Google UMP (User Messaging Platform) consent flow. It determines whether the app can request ads, surfaces a privacy options entry point when required, and supports debug forcing EEA and test devices in development builds.
Platform
- Enabled on Android by default (
#define UMP_ENABLEDwhenUNITY_ANDROID). - Skips execution in the Unity Editor (no mobile webview).
Atoms / Events
- BoolReference
adsCanRequestAds— set totrueonly when UMP reports we can request ads. - BoolReference
privacyOptionsRequired—truewhen the SDK requires a privacy options entry point. - VoidEvent
privacyOptionsRequested— call to open privacy options from a Settings button.
Dev / Test
- forceEeaInDev — force EEA geography (dev builds only).
- umpTestDeviceHashedIds — register hashed device IDs for UMP testing.
- resetConsentEachDevBoot — call
ConsentInformation.Reset()on dev boot (for QA only).
Behavior
- StartConsentFlow on app boot (outside Editor):
- Build
ConsentRequestParameters(not a kids app). - In dev: optionally register debug devices and force EEA.
- Call
ConsentInformation.Update(...)thenConsentForm.LoadAndShowConsentFormIfRequired(...).
- Build
- On consent form dismissal, updates:
adsCanRequestAds = ConsentInformation.CanRequestAds()privacyOptionsRequiredfromConsentInformation.PrivacyOptionsRequirementStatus.
- ShowPrivacyOptions() opens the UMP privacy options form if required and refreshes both atoms on close.
Threading
- Marshals SDK callbacks back to the Unity main thread using
SynchronizationContext.