Unity Ads not showing after update - #IF UNITY_ADS block not running

This morning I updated Unity from 2019.3.6 to 2019.4.6 and I noticed that my ads were no longer playing in my game.

I checked that Ads were active in the editor.
I had using UnityEngine.Advertisements in the script

I also added logging in my script to confirm everything else was working properly:

  1. Advertisement.isSupported returns true
  2. Advertisement.isInitialized returns true
  3. Advertisement.IsReady(RewardedPlacementId) returns true

but the ad never shows. I then noticed that the code in the #IF UNITY_ADS block was greyed out. So I removed the directive and the ads show again.

Any ideas on what causes the compiler to start skipping the UNITY_ADS block even when ads are enabled?

Did you also update the Ads SDK? The UNITY_ADS directive was removed in a recent SDK version.

Brilliant, Yes I did.

Did the updated SDK also remove auto ad initialization? I forgot to mention that I also need to manually invoke Advertisement.Initialize() now.

I’m not sure off the top of my head of the specifics regarding auto initialization but we’ve been encouraging users to manually initialize the SDK for a while now. It gives you greater control over when the initialization process happens and it’s clearer which game id you’re initializing with (so you’re not accidentally initializing with the wrong id)