Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Unity Advertisement 4.0.1 Multiple Ad Units

Discussion in 'Unity Ads & User Acquisition' started by jdell64, Sep 15, 2022.

  1. jdell64


    Mar 15, 2017
    I asked the question here:

    But I'll attempt to make it more clear. I have two "RewardAdsButton"s in my class. When the Player dies the first time, they can watch and ad and revive if they want ("continueAd" ad unit). The second time they die, I show them how much in-game currency they earned and say, "would you like to 2x it for an ad" ("DoubleRewards" ad unit).

    In the editor, when I play the game, the second ad I watch calls both ad units. I don't know if this is the case on the android, but it makes testing it in the editor pretty difficult. Is there a way to fix this?

    In the docs, I do not see an "unload" or "stop listening" function, but maybe I'm missing something?

    I've labeled this as a bug, but that assumes I didn't make a mistake... which I may have.

    Here is the code from the EditorPlatform.cs in Unity Advertisement's code:

    Code (CSharp):
    2.         public void Load(string placementId, IUnityAdsLoadListener loadListener)
    3.         {
    4.             if (string.IsNullOrEmpty(placementId))
    5.             {
    6.                 Debug.LogWarning("placementID cannot be null or empty, please set a placement");
    7.                 return;
    8.             }
    10.             if (!m_Initialized)
    11.             {
    12.                 m_QueuedLoads?.Enqueue(placementId);
    13.                 return;
    14.             }
    16.             m_Platform.UnityLifecycleManager.Post(() =>
    17.             {
    18.                 if (m_PlacementMap.ContainsKey(placementId))
    19.                 {
    20.                     m_PlacementMap[placementId] = true;
    21.                     loadListener?.OnUnityAdsAdLoaded(placementId);
    22.                 }
    23.                 else
    24.                 {
    25.                     string errorMessage = "Placement " + placementId + " does not exist for gameId: " + m_GameId;
    26.                     loadListener?.OnUnityAdsFailedToLoad(placementId, UnityAdsLoadError.INVALID_ARGUMENT, errorMessage);
    27.                 }
    28.             });
    29.         }
    My code is on the SO, but it is largely the same as