Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Question Unity Ads - Do we need to explicitly load new Ads after previous ad has been shown?

Discussion in 'Unity Ads & User Acquisition' started by Oblica, Dec 23, 2021.

Thread Status:
Not open for further replies.
  1. Oblica

    Oblica

    Joined:
    Feb 20, 2021
    Posts:
    30
    I am implementing Unity Ads very first time. I would like to know if I need to load/refill next ad (Banner, Interstitial and Rewarded) explicitly or Unity Ads SDK does it automatically. As this is the case with Google Mobile Ads SDK, where it is recommended to destroy and initialize Ad object after every impression shown to player. Unfortunately I cannot test Unity Ads for this scenario as even on Alpha/Beta testing on test device it again and again shows same test ads and not the production grade test ads (e.g. AdMob shows different ads every time even on a device which is added as test device). But with Unity Ads I don't have any way to know if a different ad/impression has been loaded next time.
     
    D12294 likes this.
  2. Unity_Quinn

    Unity_Quinn

    Unity Technologies

    Joined:
    Nov 6, 2020
    Posts:
    102
    Hi @OblicaStudio, thanks for asking!

    In my implementation, I include a request to load subsequent ads in the OnUnityAdsShowComplete callback.

    I hope this helps. Have a great day!
     
  3. MayIAsk

    MayIAsk

    Joined:
    Apr 11, 2016
    Posts:
    9
    Hello, what do you mean by "I include a request to load subsequent ads"?
    Do we need to load an ad everytime one has been displayed?

    Is it correct to do it like this:

    Code (CSharp):
    1.    public void LoadAd()
    2.     {
    3.         // IMPORTANT! Only load content AFTER initialization (in this example, initialization is handled in a different script).
    4.         //Debug.Log("Loading Ad: " + _adUnitId);
    5.         Advertisement.Load(_adUnitId, this);
    6.     }
    7.  
    8.  
    9.     public void OnUnityAdsShowComplete(string adUnitId, UnityAdsShowCompletionState showCompletionState)
    10.     {
    11.         //Load next ad
    12.         LoadAd();
    13.     }
     
  4. Unity_Quinn

    Unity_Quinn

    Unity Technologies

    Joined:
    Nov 6, 2020
    Posts:
    102
    Hi @MayIAsk,

    Yes, that looks good to me :)

    This is the code I use in my test project if you're curious.

    Code (CSharp):
    1.     public void LoadAd()
    2.     {
    3.         Debug.Log("Loading Ad: " + _adUnitId);
    4.         Advertisement.Load(_adUnitId, this);
    5.     }
    6.  
    7. public void OnUnityAdsShowComplete(string adUnitId, UnityAdsShowCompletionState showCompletionState)
    8.     {
    9.         LoadAd();
    10.  
    11.         if (adUnitId.Equals(_adUnitId) && showCompletionState.Equals(UnityAdsShowCompletionState.COMPLETED))
    12.         {
    13.             Debug.Log("Unity Ads Rewarded Ad Completed");
    14.         }
    15.         else if (adUnitId.Equals(_adUnitId) && showCompletionState.Equals(UnityAdsShowCompletionState.SKIPPED))
    16.         {
    17.             Debug.Log("Unity Ads Rewarded Ad Skipped");
    18.         }
    19.         else if (adUnitId.Equals(_adUnitId) && showCompletionState.Equals(UnityAdsShowCompletionState.UNKNOWN))
    20.         {
    21.             Debug.Log("Unity Ads Rewarded Ad Unknown status");
    22.         }
    23.     }
     
    Oblica and MayIAsk like this.
Thread Status:
Not open for further replies.