Unity Ads 4.1.0/4.2.1/4.3.0 Show invocation failed: Placement not ready. Error showing Ad Unit

Unity Ads 4.1.0/4.2.1/4.3.0 Show invocation failed: Placement not ready. Error showing Ad Unit rewardedVideo

Unity: 2022.1.14f1
Unity Ads (Advertisement): 4.2.1 (May 19, 2022)

Unity Ads stopped working after upgrading from 4.2.1 to 4.3.0. Downgraded back to 4.2.1 (4.3.0 became unavailable in Package Manager)

Unity Ads configured by manual
https://docs.unity.com/ads/UnityDeveloperIntegrations.html

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.Services.Core;
using Unity.Services.Core.Environments;
using UnityEngine.Advertisements;

public class AdsInitializer : MonoBehaviour, IUnityAdsInitializationListener
{
    [SerializeField] private string _androidGameId = "39XXXXX";
    [SerializeField] private string _iOSGameId = "39XXXXX ";
   
    private string _gameId;
    //
    private static GameObject playerInstance;
    public string environment = "c09XXXXX-XXXXX-XXXX XXXXX-XXXXXX09eb36507";

    void Awake()
    {
        //
#if UNITY_ANDROID
        //If your game is directed at mixed audiences, use this code to inform Unity Ads when users should not receive personalized ads
        //for Android       
        MetaData metaData = new MetaData("privacy");
        metaData.Set("mode", "mixed"); // This is a mixed audience game.
        Advertisement.SetMetaData(metaData);       
#endif
        //
        InitializeAds();
    }

    async void Start()
    {     
            var options = new InitializationOptions()
                .SetEnvironmentName(environment);

            await UnityServices.InitializeAsync(options);
    }


    public void InitializeAds()
    {
        _gameId = (Application.platform == RuntimePlatform.IPhonePlayer)
            ? _iOSGameId
            : _androidGameId;

        //  work mode
      //  Advertisement.Initialize(_gameId, false, this);//       
        //test mode
        Advertisement.Initialize(_gameId, true, this);//
    }

    public void OnInitializationComplete()
    {
        Debug.Log("Unity Ads initialization complete.");       //
    }

    public void OnInitializationFailed(UnityAdsInitializationError error, string message)
    {
        Debug.Log($"Unity Ads Initialization Failed: {error.ToString()} - {message}");
    }
}
RewardedAds.cs

using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Advertisements;
using UnityEngine.SceneManagement;

public class RewardedAds : MonoBehaviour, IUnityAdsLoadListener, IUnityAdsShowListener
{
   string _adUnitId = null;
   
    //

    void Awake()
    {

#if UNITY_IOS
     _adUnitId = "rewardedVideo";
#endif

#if UNITY_ANDROID
           _adUnitId = "rewardedVideo";
#endif
       

    }
    // Load content to the Ad Unit:
    public void LoadAd()
    {
        // IMPORTANT! Only load content AFTER initialization (in this example, initialization is handled in a different script).
        Debug.Log("Loading Ad: " + _adUnitId);
          Advertisement.Load(_adUnitId, this);
    }

    // If the ad successfully loads, add a listener to the button and enable it:
    public void OnUnityAdsAdLoaded(string adUnitId)
    {
        Debug.Log("Ad Loaded: " + adUnitId);

        if (adUnitId.Equals(_adUnitId))
        {
        }
    }

    // Implement a method to execute when the user clicks the button.
    public void ShowAd()
    {
                     // Then show the ad:
          Advertisement.Show(_adUnitId, this);      
    }

    // Implement the Show Listener's OnUnityAdsShowComplete callback method to determine if the user gets a reward:
    public void OnUnityAdsShowComplete(string adUnitId, UnityAdsShowCompletionState showCompletionState)
    {
        //  Debug.Log("do it");
        Debug.Log(adUnitId);
        if (adUnitId.Equals(_adUnitId) && showCompletionState.Equals(UnityAdsShowCompletionState.COMPLETED))
        {
            Debug.Log("Unity Ads Rewarded Ad Completed");
            // Grant a reward.
          
                int iigold = PlayerPrefs.GetInt("iigold");
                igold = iigold + 1;
                PlayerPrefs.SetInt("iigold", iigold);
                        }
    }

    // Implement Load and Show Listener error callbacks:
    public void OnUnityAdsFailedToLoad(string adUnitId, UnityAdsLoadError error, string message)
    {
        Debug.Log($"Error loading Ad Unit {adUnitId}: {error.ToString()} - {message}");
        // Use the error details to determine whether to try to load another ad.
    }

    public void OnUnityAdsShowFailure(string adUnitId, UnityAdsShowError error, string message)
    {
        Debug.Log($"Error showing Ad Unit {adUnitId}: {error.ToString()} - {message}");
        // Use the error details to determine whether to try to load another ad.
    }

    public void OnUnityAdsShowStart(string adUnitId) { }
    public void OnUnityAdsShowClick(string adUnitId) { }

    void OnDestroy()
    {
    }
}

In Unity Editor Unity Ads work fine

But on real device Unity Ads don’t work, throws errors in the log:

Show invocation failed: Placement not ready
Error showing Ad Unit rewardedVideo:

Full Log

08-25 12:21:08.385 20868 20922 I Unity   : Unity.Services.Analytics.Internal.Buffer:FlushToDisk()
08-25 12:21:08.385 20868 20922 I Unity   : Unity.Services.Analytics.Internal.<>c__DisplayClass13_0:<FlushBufferToService>b__1(Int64)
08-25 12:21:08.385 20868 20922 I Unity   : UnityEngine.AsyncOperation:InvokeCompletionEvent()
08-25 12:21:08.385 20868 20922 I Unity   :
08-25 12:21:09.446 20868 21226 W UnityAds: com.unity3d.services.core.api.Sdk.logWarning() (line:79) :: {"message":"model: DeviceInfo key: openAdvertisingTrackingId with value: null: null is not in: string,undefined","name":"CheckValueError"}
08-25 12:21:09.841 20868 21226 I UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:85) :: Requesting configuration from https://publisher-config.unityads.unity3d.com/games/3968719/configuration?deviceMake=Sony&screenDensity=560&screenSize=268435810&idfi=6fb6ed07774138f488750e4fcca7585a&advertisingTrackingId=00000000-0000-0000-0000-000000000000&limitAdTracking=false&installationId=6fb6ed07774138f488750e4fcca7585a&connectionType=cellular&screenHeight=1440&screenWidth=2712&bundleId=ssfm.proj.ew&encrypted=true&rooted=false&platform=android&sdkVersion=4210&osVersion=10&deviceModel=H9493&language=ru_RU&test=true&analyticsUserId=6fb6ed07774138f488750e4fcca7585a&analyticsSessionId=2121235812310092326&first=true&framework=%5Bobject%20Object%5D&adapter=%5Bobject%20Object%5D&userLevelFlagDetected=false&dpm=mixed
08-25 12:21:10.870 20868 21226 I UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:85) :: Received configuration for token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHAiOjIwMiwiYXBwTGV2ZWxDb3BwYSI6dHJ1ZSwiYXR0IjowLCJhdWMiOjI1MCwiYXVpIjoyMjgsImF6cCI6ImQyM2FkYjJjLTAwNGItNGE0NC1hMjUzLWZhYTVmNmVkMTRjOSIsImNhbGN1bGF0ZWRDb3BwYSI6dHJ1ZSwiY29uc2VudCI6ZmFsc2UsImNvbnRleHR1YWxPbmx5IjpmYWxzZSwiY3BpIjoxNzcsImNyZWF0ZWQiOjE2NjEzOTQwNzEwMDAsImRsdCI6MCwiZHQiOjAsImV0dCI6WzIxNDc0ODM4ODUsNTM0NSw1MzQ5LDU0MzEsNzM0Niw1OTYzLDcxMDUsNTc1Niw3MzEwLDczNDddLCJleHAiOjE2NjI2MDM2NzEsImlhcCI6MTU5LCJpYXQiOjE2NjEzOTQwNzEsImlnIjoiVlpuWmhMSHpVRDVzWnlJR2J6SHNIVGxYcXZtbHRyTDRiVm5JNFV1bm1XSEV1Q0pqMEdLamM1SXkwbGQ2bWVpVGJEUVNhUT09IiwiaW5zdGFsbGF0aW9uSWQiOiI2ZmI2ZWQwNzc3NDEzOGY0ODg3NTBlNGZjY2E3NTg1YSIsImlzcyI6ImFkcy1zZGstY29uZmlndXJhdGlvbi51bml0eWFkcy51bml0eTNkLmNvbSIsImxlZ2FsVGVycml0b3J5IjowLCJsdHYiOjI4LCJtaXhlZCI6ZmFsc2UsInBybyI6MTczLCJwcm94aWVkIjpmYWxzZSwic3ViIjoicUlhdit5bEN5M0lkd2tMSzhLRXVyeVlrK1oxRkZlZFE1YTVFQkhFeVJySnozeE0yakZoVXlSUXJwWkszazdFeTdJLzQ2UT09IiwidGd0IjoyMzMsInhwciI6MjA1fQ.8NO_BLIeW_2AukMZF1SDkk8PveGJduQZTphr_kd7qSg (A/B group 5)
08-25 12:21:10.929 20868 20922 I Unity   : Unity Ads initialization complete.
08-25 12:21:10.929 20868 20922 I Unity   : UnityEngine.Advertisements.Utilities.CoroutineExecutor:Update()
08-25 12:21:10.929 20868 20922 I Unity   :
08-25 12:21:12.441 20868 21226 I UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:85) :: Webview started using the latest version
08-25 12:21:22.457 20868 21226 E UnityAds: com.unity3d.services.core.api.Sdk.logError() (line:73) :: Show invocation failed: Placement not ready
08-25 12:21:22.489 20868 20922 I Unity   : Error showing Ad Unit rewardedVideo: NOT_READY - Placement not ready08-25 12:21:22.489 20868 20922 I Unity   : RewardedAds:OnUnityAdsShowFailure(String, UnityAdsShowError, String)08-25 12:21:22.489 20868 20922 I Unity   : UnityEngine.Advertisements.Utilities.CoroutineExecutor:Update()
08-25 12:21:22.489 20868 20922 I Unity   :
08-25 12:21:58.341 20868 20922 I Unity   : Flushed up to token index 89, cache file is 2512B
08-25 12:21:58.341 20868 20922 I Unity   : Unity.Services.Analytics.Internal.Buffer:FlushToDisk()
08-25 12:21:58.341 20868 20922 I Unity   : Unity.Services.Analytics.Internal.<>c__DisplayClass13_0:<FlushBufferToService>b__1(Int64)
08-25 12:21:58.341 20868 20922 I Unity   : UnityEngine.AsyncOperation:InvokeCompletionEvent()
08-25 12:21:58.341 20868 20922 I Unity   :0
1 Like

I’m having the same error I wrote them and they said it’s takes time for it to cache before ads can be displayed . It been 3 days now and I’m still waiting for the ads to cache. Smart developers they have there at unity.

The error you are seeing usually occurs when a placement has not been loaded and has been requested to be shown anyway.

What you are likely experiencing is a result of recent changes to how the Unity Ads SDK handles the initial loading of placements. As a result of these changes, you are now required to load all placements before showing them. Previously the Unity Ads SDK would request all placements upon initialization, this is no longer the case.

As such you will now need to load your placements. To do this I would advise calling your load function in the Initialization Complete callback.

Now the ad is running, but only the first time, the second time the ad is not running, but gives an error
“Error showing Ad Unit rewardedVideo: NOT_READY - Placement not ready”

public void InitializeAds()
    {
        _gameId = (Application.platform == RuntimePlatform.IPhonePlayer)
            ? _iOSGameId
            : _androidGameId;
    
        Advertisement.Initialize(_gameId, false, this);
    }

    public void OnInitializationComplete()
    {
        Advertisement.Load(placementId);//
        Debug.Log("Unity Ads initialization complete.");       //
    }

Note: if I place in code “Advertisement.Load(placementId, this);” ,

Error appear “Assets\Resources\PluginNetwork\UnityAds\AdsInitializer.cs(82,41): error CS1503: Argument 2: cannot convert from ‘AdsInitializer’ to ‘UnityEngine.Advertisements.IUnityAdsLoadListener’”

When I first run an ad (first tap on Ads button): everything plays – Unity Ads is OK

09-04 19:59:35.837  6406  6406 I Unity   : Unity Ads initialization complete.
09-04 19:59:35.837  6406  6406 I Unity   : System.Reflection.RuntimeMethodInfo:Invoke(Object, BindingFlags, Binder, Obje
ct[], CultureInfo)
09-04 19:59:35.837  6406  6406 I Unity   : UnityEngine.AndroidJavaProxy:Invoke(String, Object[])
09-04 19:59:35.837  6406  6406 I Unity   : UnityEngine._AndroidJNIHelper:InvokeJavaProxyMethod(AndroidJavaProxy, IntPtr,
IntPtr)
09-04 19:59:35.837  6406  6406 I Unity   :
09-04 19:59:37.014  6406  6851 I UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:85) :: Webview started usin
g the latest version
09-04 19:59:39.022  1331  3891 I ExtendedUtils: printFileName fd(13) -> /storage/emulated/0/Android/data/ssfm.proj.ew/ca
che/UnityAdsCache/UnityAdsCache-9fda65136d9938a7eed20e374e6edabef0d8f7afb46247fd2dd04b3a3551b5c0.mp4
09-04 19:59:46.019  6406  6851 I UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:85) :: Opening performance
ad unit with orientation LANDSCAPE, hardware acceleration enabled
09-04 19:59:46.021  1765  4402 I ActivityTaskManager: START u0 {flg=0x10010000 cmp=ssfm.proj.ew/com.unity3d.services.ads
.adunit.AdUnitActivity (has extras)} from uid 10604
09-04 19:59:46.114  1765  1835 I ActivityTaskManager: Displayed ssfm.proj.ew/com.unity3d.services.ads.adunit.AdUnitActiv
ity: +91ms
09-04 19:59:46.188  6406  6406 W MediaPlayer: Couldn't open https://cdn-creatives-akamaistls-prd.acquire.unity3dusercont
ent.com/...
09-04 19:59:46.188  6406  6406 W MediaPlayer: java.io.FileNotFoundException: No content provider: https://cdn-creatives-
akamaistls-prd.acquire.unity3dusercontent.com/impact/11017/blue_test_trailer_legacy.mp4
09-04 19:59:46.188  6406  6406 W MediaPlayer:   at com.unity3d.services.ads.video.VideoPlayerView.prepare(VideoPlayerVie
w.java:131)
09-04 19:59:46.188  6406  6406 W MediaPlayer:   at com.unity3d.services.ads.api.VideoPlayer$2.run(VideoPlayer.java:65)
09-04 19:59:50.737  6406  6851 I UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:85) :: Unity Ads event: sen
ding start event to https://publisher-event.unityads.unity3d.com/events/v2/video/video_start/3968719/0000000000000000000
00000
09-04 19:59:52.943  6406  6851 I UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:85) :: Unity Ads event: sen
ding first_quartile event to https://publisher-event.unityads.unity3d.com/events/v2/video/first_quartile/3968719/0000000
00000000000000000
09-04 19:59:55.447  6406  6851 I UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:85) :: Unity Ads event: sen
ding midpoint event to https://publisher-event.unityads.unity3d.com/events/v2/video/midpoint/3968719/0000000000000000000
00000
09-04 19:59:58.188  6406  6851 I UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:85) :: Unity Ads event: sen
ding third_quartile event to https://publisher-event.unityads.unity3d.com/events/v2/video/third_quartile/3968719/0000000
00000000000000000
09-04 20:00:00.561  6406  6851 I UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:85) :: Unity Ads event: sen
ding view event to https://publisher-event.unityads.unity3d.com/events/v2/video/video_end/3968719/0000000000000000000000
00

When I launch the ad for the second time (second tap on Ads button), it gives an error “Error showing Ad Unit rewardedVideo: NOT_READY - Placement not ready”

09-04 20:02:36.662  6406  6406 I Unity   : rewardedVideo
09-04 20:02:36.662  6406  6406 I Unity   : RewardedAds:OnUnityAdsShowComplete(String, UnityAdsShowCompletionState)
09-04 20:02:36.662  6406  6406 I Unity   : System.Reflection.RuntimeMethodInfo:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo
)
09-04 20:02:36.662  6406  6406 I Unity   : UnityEngine.AndroidJavaProxy:Invoke(String, Object[])
09-04 20:02:36.662  6406  6406 I Unity   : UnityEngine._AndroidJNIHelper:InvokeJavaProxyMethod(AndroidJavaProxy, IntPtr, IntPtr)
09-04 20:02:36.662  6406  6406 I Unity   :
09-04 20:02:36.663  6406  6406 I Unity   : Unity Ads Rewarded Ad Completed
09-04 20:02:36.663  6406  6406 I Unity   : RewardedAds:OnUnityAdsShowComplete(String, UnityAdsShowCompletionState)
09-04 20:02:36.663  6406  6406 I Unity   : System.Reflection.RuntimeMethodInfo:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo
)
09-04 20:02:36.663  6406  6406 I Unity   : UnityEngine.AndroidJavaProxy:Invoke(String, Object[])
09-04 20:02:36.663  6406  6406 I Unity   : UnityEngine._AndroidJNIHelper:InvokeJavaProxyMethod(AndroidJavaProxy, IntPtr, IntPtr)
09-04 20:02:36.663  6406  6406 I Unity   :
09-04 20:02:36.698  6406  6472 I Unity   : AppsFlyer_Unity_v6.3.1 didReceiveConversionDataWithError called with Launch status code: 403
09-04 20:02:37.247  6406  6472 I Unity   : Flushed up to token index 89, cache file is 2512B
09-04 20:02:37.247  6406  6472 I Unity   : Unity.Services.Analytics.Internal.Buffer:FlushToDisk()
09-04 20:02:37.247  6406  6472 I Unity   : Unity.Services.Analytics.Internal.<>c__DisplayClass13_0:<FlushBufferToService>b__1(Int64)
09-04 20:02:37.247  6406  6472 I Unity   : UnityEngine.AsyncOperation:InvokeCompletionEvent()
09-04 20:02:37.247  6406  6472 I Unity   :
09-04 20:02:44.589  6406  6851 E UnityAds: com.unity3d.services.core.api.Sdk.logError() (line:73) :: Show invocation failed: Placement no
t ready
09-04 20:02:44.617  6406  6406 I Unity   : Error showing Ad Unit rewardedVideo: NOT_READY - Placement not ready
09-04 20:02:44.617  6406  6406 I Unity   : RewardedAds:OnUnityAdsShowFailure(String, UnityAdsShowError, String)
09-04 20:02:44.617  6406  6406 I Unity   : System.Reflection.RuntimeMethodInfo:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo
)
09-04 20:02:44.617  6406  6406 I Unity   : UnityEngine.AndroidJavaProxy:Invoke(String, Object[])
09-04 20:02:44.617  6406  6406 I Unity   : UnityEngine._AndroidJNIHelper:InvokeJavaProxyMethod(AndroidJavaProxy, IntPtr, IntPtr)
09-04 20:02:44.617  6406  6406 I Unity   :

You need to ensure that you are always loading an ad prior to calling the ad to show. The easiest way to do this is to add a load call into your Show Complete callback.

Maybe helpfull for anybody. It’s solved

If you just put “Advertisement.Load(placementId, this);” inside a function “OnUnityAdsShowComplete” callback (file RewardedAds.cs), it won’t work.

private string _adUnitId = "rewardedVideo";

public void OnUnityAdsShowComplete(string adUnitId, UnityAdsShowCompletionState showCompletionState)
    { 
        Debug.Log(adUnitId);
        if (adUnitId.Equals(_adUnitId) && showCompletionState.Equals(UnityAdsShowCompletionState.COMPLETED))
        {    
            // Grant a reward.
       Advertisement.Load(_adUnitId, this);
}
}

For advertising to work as it should, additionally you need to put “Advertisement.Load(placementId);” inside the function “OnInitializationComplete()” callback (file: AdsInitializer.cs)

    private string placementId = "rewardedVideo";
    public void OnInitializationComplete()
        {
             Advertisement.Load(placementId);//
            Debug.Log("Unity Ads initialization complete.");       //
        }

thanks! it works! after putting “Advertisement.Load(placementId);” inside the function “OnInitializationComplete()” callback…

however, subsequent advertisement invocation shows placement not ready, do I have to always call Advertisement.Load(placementId) before calling Advertisement.Show(“rewarded_video”, this); ? i think we need to do that

Why do Rewarded videos or Interstitial video testmodes become heavy and have long video durations?

Why do Rewarded videos or Interstitial video testmodes become heavy and have long video durations?