Search Unity

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

Question advertisement does not contain a definition for IsReady

Discussion in 'Unity Ads & User Acquisition' started by KEIKAS, Dec 24, 2021.

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

    KEIKAS

    Joined:
    Jan 5, 2020
    Posts:
    3
    I'm trying to add advertisements into my game game, but I keep getting this error any suggestions?
    Error: advertisement does not contain a definition for IsReady


    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. {
    9.  
    10.     void Start()
    11.     {
    12.         Advertisement.Initialize("123456", true); //this is Android/Ios gameID example. "true" is in the test mode, need to change it if it is not in a test mode
    13.  
    14.     }
    15.  
    16.  
    17.     public void showAd()
    18.  
    19.     {
    20.         if (Advertisement.IsReady("gameAd"))
    21.             Advertisement.Show("gameAd");
    22.         else
    23.             Debug.Log("Ad is not ready");
    24.  
    25.     }
    26.  
    27. }
     
  2. D12294

    D12294

    Joined:
    Oct 6, 2020
    Posts:
    81
    Jason_YLin and KEIKAS like this.
Thread Status:
Not open for further replies.