Search Unity

Advertisement.IsReady returns false everytime

Discussion in 'Unity Ads & User Acquisition' started by TortoRacoon, Jul 17, 2019.

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

    TortoRacoon

    Joined:
    Apr 17, 2019
    Posts:
    61
    So I'm trying to get Unity Ads to work, I'm doing it for the first (I'm a total 1000% newb) time so I'm going along the instructuins in https://unityads.unity3d.com/help/monetization/getting-started

    This is what I've done so far:
    I downloaded this Asset and imported it to my project
    upload_2019-7-17_10-38-4.png

    I settled the organization thing in the Dashboard
    upload_2019-7-17_10-43-19.png
    In the project with the SDK imported, I toggled the Ads thing with the Testing checked
    upload_2019-7-17_10-45-5.png
    then added some code to test it out (I added the script to an object in the scene), based on the PLACEMENTs section I setted the normal video and rewarded video.


    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.Advertisements;
    5.  
    6. public class AdManager : MonoBehaviour
    7. {
    8.     public void PlayThatAdMister()
    9.     {
    10.         if(Advertisement.IsReady("video"))
    11.         {
    12.             Advertisement.Show("video");
    13.             Debug.Log("This thing should show an AD");
    14.         }
    15.         else
    16.         {
    17.             Debug.Log("Advertisement is ready :" + Advertisement.IsReady("video"));
    18.         }
    19.     }
    20.  
    21.     public void PlayARewarded()
    22.     {
    23.         if(Advertisement.IsReady("rewardedVideo"))
    24.         {
    25.             Advertisement.Show("rewardedVideo");
    26.             Debug.Log("This thing should show a Rewarded AD");
    27.         }
    28.         else
    29.         {
    30.             Debug.Log("Advertisement is ready :" + Advertisement.IsReady("video"));
    31.         }
    32.     }
    33.  
    34.  
    35.     private void Update()
    36.     {
    37.         if (Input.GetKeyDown(KeyCode.E))
    38.         {
    39.             PlayThatAdMister();
    40.             Debug.Log("I am pressing E key");
    41.         }
    42.  
    43.         if(Input.GetKeyDown(KeyCode.R))
    44.         {
    45.             PlayARewarded();
    46.             Debug.Log("I am pressing E key");
    47.         }
    48.     }
    49. }
    50.  
    It was not showing a thing so I wrote some logs as shown above. It turns out that the Advertisement.IsReady was returning false always...
     

    Attached Files:

  2. nich2408

    nich2408

    Joined:
    Jun 27, 2018
    Posts:
    9
    Do some checks:
    • Is Advertisement.Initialize() working? (I don't see ad initialization in your script)
    • Is the placement name correct?
    I also suggest you to turn off "test mode enabled" on Editor and using "override client" (force test mode across all devices) via Dashboard
    Hope this helps
     
    YukiKomine and TortoRacoon like this.
  3. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    Sanjay112000 and TortoRacoon like this.
Thread Status:
Not open for further replies.