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. Dismiss Notice

Advertisement.IsReady(placementId) always returns false.

Discussion in 'Unity Ads & User Acquisition' started by unity_ycAc5ynYwYxpFQ, Sep 25, 2020.

  1. unity_ycAc5ynYwYxpFQ

    unity_ycAc5ynYwYxpFQ

    Joined:
    Sep 17, 2017
    Posts:
    8
    Hi,

    I can't figure out why adds are not showing in my game. This is an Android build. I downloaded the lastest Unity Ads package. Everything seems to be set up correctly in the Unity Dashboard.

    Advertisement.IsReady(placementId) always returns false and I don't know why.

    I looked for solutions on this forum but none worked.

    This is driving me nuts. Could you guys help me ou
    Code (CSharp):
    1. public class AdsManager : MonoBehaviour
    2. {
    3.     public bool testMode;
    4.  
    5.     public string gameId = "XXXX";
    6.  
    7.     public string placementId = "bann";
    8.  
    9.  
    10.     public IEnumerator Start()
    11.     {
    12.         Debug.Log("Advertisement.Initialize");
    13.  
    14.         Advertisement.Initialize(gameId, testMode);
    15.  
    16.         while(!Advertisement.IsReady(placementId))
    17.         {
    18.             Debug.Log("Advertisement NOT ready");
    19.             yield return null;
    20.         }
    21.  
    22.         Debug.Log("Advertisement ready");
    23.  
    24.         Advertisement.Banner.Show(placementId);
    25.  
    26.     }
    27.  
    28.  
    29.  
    30. }
    t?
     
  2. sbankhead

    sbankhead

    Unity Technologies

    Joined:
    Jul 27, 2014
    Posts:
    97
    Can you include a log. You can direct message me if you prefer to keep it private. Nothing looks wrong with what you shared in your script, so my top guesses are these:

    1) You have no fill and so the placement is not ready, which is technically working as expected. Whats your region?
    2) You typo'd your gameId (including swapping android and ios gameId)
    3) You typo'd your placement id.. (bann does look a little suspect...maybe you meant banner?)
     
  3. unity_ycAc5ynYwYxpFQ

    unity_ycAc5ynYwYxpFQ

    Joined:
    Sep 17, 2017
    Posts:
    8
    This working now. But only in test mode. What I had to do is declare the gameId and placementId variables inside the function itself.
    Code (CSharp):
    1. public IEnumerator Start()
    2.     {
    3.         string gameId = "3836901";
    4.  
    5.         string placementId = "banner";
    6.  
    7.         Debug.Log("Advertisement.Initialize");
    8.  
    9.         Advertisement.Initialize(gameId, false);
    10.  
    11.         while(!Advertisement.IsReady(placementId))
    12.         {
    13.             Debug.Log("Advertisement NOT ready");
    14.             yield return null;
    15.         }
    16.  
    17.         Debug.Log("Advertisement ready");
    18.  
    19.         Advertisement.Banner.SetPosition(BannerPosition.TOP_CENTER);
    20.  
    21.         Advertisement.Banner.Show(placementId);
    22.     }
    But I have another problem. The adds won't show in production.
     
    Last edited: Sep 26, 2020
  4. kyle-unity

    kyle-unity

    Unity Technologies

    Joined:
    Jan 6, 2020
    Posts:
    336
    Can you post a full device log from a production game session? (You can record this using Logcat for Android and XCode for iOS)

    This should give us a clue as to what is going wrong. It's possible it's a no fill issue, meaning no banners are currently available (this can happen for banners in some regions).
     
  5. unity_ycAc5ynYwYxpFQ

    unity_ycAc5ynYwYxpFQ

    Joined:
    Sep 17, 2017
    Posts:
    8
    Is it that enough? I used this command line: adb logcat -s Unity
     

    Attached Files:

  6. kyle-unity

    kyle-unity

    Unity Technologies

    Joined:
    Jan 6, 2020
    Posts:
    336
    Hi, sorry for the delay in getting back to you about this. I don't see any no fill errors in that log, so it looks like that isn't the issue. However, I do see some errors in there that may be behind this.

    Are you able to post a build of your game? If you don't want to do that publicly, you can send it to unityads-support@unity3d.com to open a support ticket with us.