Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question What is the equal of Advertisement.isReady

Discussion in 'Unity Ads & User Acquisition' started by mfatihbarut, Jan 10, 2022.

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

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    1,058
    Hi,
    in the last version of ads, there is no isReady function.
    So, how can we check if ads is ready (loaded)?
     
    calurin likes this.
  2. aylin_unity3d

    aylin_unity3d

    Unity Technologies

    Joined:
    Apr 6, 2015
    Posts:
    45
    Hi,
    In SDK versions 3.7.0 and higher, you can use the IUnityAdsLoadListener and IUnityAdsShowListener callbacks to implement logic for when content succeeds or fails to load or show respectively.

    So you can use this to check if ads are loaded ok

    // Implement Load Listener and Show Listener interface methods:
    public void OnUnityAdsAdLoaded(string adUnitId)
    {
    // Optionally execute code if the Ad Unit successfully loads content.
    }

    Please refer to this guide page to understand it
    https://docs.unity.com/ads/ImplementingBasicAdsUnity.htm
    https://docs.unity.com/ads/ImplementingRewardedAdsUnity.htm
     
    ManoKristos likes this.
  3. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    1,058
    in my story, it is a little bit different than that is. I already use OnUnityAdsAdLoaded.
    But somehow ad is not loading. therefore I check every second if ads is initlized and load ads.
    but of course, it can be dangerous because I over load ads server by loading ads every second.
    Therefore I need to check if ads is loaded and if it is not ready I have to load it again.
     
    Last edited: Jan 11, 2022
  4. SamOYUnity3D

    SamOYUnity3D

    Unity Technologies

    Joined:
    May 12, 2019
    Posts:
    623
    You don't need to check every second if ads is initlized and load ads.
    Please check the placementId when OnUnityAdsAdLoaded is triggered, and pass this placementId in the Show method. By doing this the Ad should be shown. If not, please provide the device log so we can check it.
    upload_2022-1-11_14-47-56.png
     
  5. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    1,058
    this causes a vicious circle. How can I check if ad is loaded by loading it? I need to check it before I try to load it again and obviously isadsready function was a great solution for it.

    And I am just wondering are you working as 2 teams. The first team (which is the great one) produce something (function and variables) very useful and second team comes and say "Lets depracate it" but why?
    while it works as needed
    Why am I really considered in every update of you by thinking "O God what did they ruin this time, I hope not something I am using now".....
     
  6. aylin_unity3d

    aylin_unity3d

    Unity Technologies

    Joined:
    Apr 6, 2015
    Posts:
    45
    Hey, OnUnityAdsAdLoaded will be called when the ad is loaded. So you can use the OnUnityAdsAdLoaded
    For example, you can enable the ad button when the ad is loaded.

    // 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))
    {
    // Configure the button to call the ShowAd() method when clicked:
    _showAdButton.onClick.AddListener(ShowAd);
    // Enable the button for users to click:
    _showAdButton.interactable = true;
    }
    }
     
  7. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    1,058
    honey, i am already doing it but the problem is that I load ads at the beginning of the level (because it is not predictable when will I need it, when the player will finish the game) and if I wait too long (the player plays the game for a few minutes) the ads goes away. So I need to check if the loaded ads is still fresh. Otherwise, my rewarded ads button becomes useless. This is what I see if I am not wrong.
     
    Last edited: Jan 13, 2022
    muttsang likes this.
  8. SamOYUnity3D

    SamOYUnity3D

    Unity Technologies

    Joined:
    May 12, 2019
    Posts:
    623
    The loaded ads shouldn't go away, it's not expected behavior. If you can reproduce it, please provide the device log so we can investigate further.
     
Thread Status:
Not open for further replies.