Search Unity

UnityEngine.Advertisements.Advertisement does not contain a definition for `isReady'

Discussion in 'Unity Ads & User Acquisition' started by u_rs, Mar 13, 2016.

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

    u_rs

    Joined:
    Jan 5, 2016
    Posts:
    147
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using UnityEngine.Advertisements;
    4.  
    5. public class NewBehaviourScript : MonoBehaviour {
    6.     void Start ()
    7.     {
    8.         Advertisement.Initialize ("1042635", true);
    9.     }
    10.  
    11.     public void Buton()
    12.     {
    13.         StartCoroutine (ShowAdWhenReady());
    14.     }
    15.  
    16.     IEnumerator ShowAdWhenReady()
    17.     {
    18.         while (!Advertisement.isReady())
    19.             yield return null;
    20.  
    21.         Advertisement.Show ();
    22.     }
    23.  
    24. }
     
    Last edited by a moderator: Mar 13, 2016
  2. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    tbonetimmons likes this.
  3. u_rs

    u_rs

    Joined:
    Jan 5, 2016
    Posts:
    147
    Now: 'Advertisement' doesn't exists in the current context
     
  4. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    Then did you change something else? Are you e.g. building for Android or iOS?
     
  5. u_rs

    u_rs

    Joined:
    Jan 5, 2016
    Posts:
    147
    Didn't change anything else. For Windows, now there are no errors - it's just doesn't show anything.
     
  6. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    Doesn't show where? Unity Ads only supports Android and iOS
     
  7. u_rs

    u_rs

    Joined:
    Jan 5, 2016
    Posts:
    147
    What could I use in Unity for monetization of Windows apps ?
     
  8. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    PC or mobile?
     
  9. u_rs

    u_rs

    Joined:
    Jan 5, 2016
    Posts:
    147
  10. solomonli

    solomonli

    Unity Technologies

    Joined:
    Mar 4, 2016
    Posts:
    10
    UnityAds doesn't support Windows, neither on PC nor on mobile, try clean project's source files and dependencies, if the compile could not successfully compiled to class Advertisement, this may cause class doesn't exist. And don't forget try to use IsReady(), hope you can make it work.
     
  11. JoshGordon1

    JoshGordon1

    Joined:
    May 5, 2017
    Posts:
    1
    My error says: UnityEngine.Advertisements.Advertisement' does not contain a definition for `Banner'
    How to solve this?
     
  12. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @JoshGordon1
    That would likely be because you are using an older version of the Unity Ads package. Banners are only available in 3.0+.
    • Which version of Unity are you using?
    • How did you install the Unity Ads package: Asset Store or Services Window?
    https://forum.unity.com/threads/how...ge-package-manager-or-services-window.699005/
     
    AAAAAAAAAE likes this.
Thread Status:
Not open for further replies.