Unity Ads Not Loading After Consent Dialog - GDPR and SDK Fix

Problem: Your Unity game shows a GDPR/consent dialog, but after the player clicks to allow/opt in, Unity Ads never loads (no banner/rewarded/interstitial appears). In logs, you may see symptoms like initialization happened too early, ad requests returning failures, or callbacks not firing as expected.

Root Cause: In most cases, the consent decision is not applied to the Unity Ads SDK before (or at the moment) ad initialization and load requests occur. If the SDK is initialized before consent signals are set, or if you request ads in the same flow as consent without waiting for the consent callback, the SDK may refuse targeting/data processing and your later load calls won’t recover.

This fix focuses on one reliable rule: apply consent signals, then initialize and load ads.


Quick Fix Solutions

Solution 1: Gate Advertisement.Initialize and ad loads behind the consent callback

Problem: Ads are requested before the consent flow finishes, or the consent signal is never passed into the Unity Ads SDK.

Steps:

  1. Make consent an asynchronous gate.
    • Start your consent flow (Unity CMP, your CMP, UMP, etc.) on launch.
  2. Wait for the user decision.
    • Only when you have an explicit result (opt-in / opt-out) should you proceed to ad SDK initialization and ad load calls.
  3. Pass the decision to Unity Ads GDPR consent APIs.
    • Unity’s GDPR docs describe privacy/consent APIs (example concepts include setUserConsent() / setUserOptOut() and related signals).
  4. Initialize Unity Ads after consent signals are set.

Minimal code pattern (illustrative):

using UnityEngine;
using UnityEngine.Advertisements;

public class ConsentGateAds : MonoBehaviour, IUnityAdsInitializationListener
{
    [SerializeField] string gameId = "YOUR_GAME_ID";
    [SerializeField] bool testMode = true;

    void Start()
    {
        // 1) Begin consent flow here (Unity CMP / UMP / your CMP).
        // 2) Then call InitializeAdsOnceConsentIsKnown(optIn);
    }

    public void InitializeAdsOnceConsentIsKnown(bool optIn)
    {
        // 3) Apply consent signal to the Unity Ads SDK (per Unity GDPR docs).
        // Names can vary by Unity Ads version; follow the official consent API docs.
        Advertisement.setUserConsent(optIn);

        // 4) Initialize after consent is applied.
        Advertisement.Initialize(gameId, testMode, this);
    }

    public void OnInitializationComplete()
    {
        // Now it is safe to load/show ads.
        // Advertisement.Load(...) / Advertisement.Show(...)
    }

    public void OnInitializationFailed(UnityAdsInitializationError error, string message)
    {
        Debug.LogError($"Unity Ads init failed: {error} - {message}");
    }
}

Verification:

  1. Enable debug logging for Unity Ads in your dev build.
  2. Run on a device in the EEA (or use Unity Ads testing that triggers the consent behavior).
  3. Confirm:
    • consent dialog appears
    • you receive the consent result callback
    • OnInitializationComplete fires after consent is applied
    • you can load/show at least one ad format successfully

Solution 2: If you initialized too early, re-initialize after the consent decision

Problem: Advertisement.Initialize ran before consent was known.

Steps:

  1. Move Advertisement.Initialize out of Start() / Awake() if it runs before consent.
  2. If you can’t refactor immediately:
    • ensure ad load/show calls do not happen until after consent
    • set the consent signal on the SDK once the player decides
    • then call Advertisement.Initialize again (using the same gameId and appropriate testMode)

Verification:

  1. Add one log line right before the re-initialization call.
  2. Confirm initialization complete fires after the consent click, not earlier.

Solution 3: Remove “instant load” calls from the consent flow

Problem: You call Load/Show in the same place where you display the consent dialog, but before the SDK knows the final state.

Steps:

  1. Search your code for ad calls (Load, Show, rewarded/interstitial/banner requests).
  2. Ensure those calls run only inside the consent callback (or a function invoked from it).
  3. Remove any startup coroutines that queue ad loads without checking consent completion.

Verification:

  1. Temporarily add Debug.Log right before each ad load call.
  2. Confirm no ad load runs until after you have the consent decision result.

Solution 4: Confirm your “opt-out” behavior matches GDPR expectations

Problem: The player opts out, but your code still tries to load targeted ads as if consent were granted.

Steps:

  1. If opt-out means “no personalized ads,” ensure your logic:
    • does not request/show targeted placements
    • optionally uses non-behavioral/contextual signals if supported by your Unity Ads privacy API usage
  2. If you support both:
    • keep two code paths: opt-in load vs opt-out fallback

Verification:

  1. Test both opt-in and opt-out.
  2. Confirm the behavior is consistent with what Unity Ads privacy APIs are set to.

Prevention Tips

  • Treat consent as an asynchronous dependency: “no consent result, no ads init, no ads load.”
  • Centralize ad initialization in one place (one “AdController” component) so you don’t accidentally initialize from multiple scripts.
  • Never request ads on the same frame as showing the consent dialog.
  • Keep “test mode” IDs separate from production IDs (and verify you are testing with the correct build configuration).

Related Problems and Links


Official Documentation (GDPR / Consent)

Bookmark this fix for quick reference. If ads still do not load after gating initialization behind consent, share your consent callback flow (where you call initialization and where you call load/show) so you can pinpoint the exact timing mistake.