Search Unity

  1. Check out our Unite Austin 2017 YouTube playlist to catch up on what you missed. More videos coming soon.
    Dismiss Notice
  2. Unity 2017.2 is now released.
    Dismiss Notice
  3. The Unity Gear Store is here to help you look great at your next meetup, user group or conference. With all new Unity apparel, stickers and more!
    Dismiss Notice
  4. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  6. Unity 2017.3 beta is now available for download.
    Dismiss Notice
Dismiss Notice
Unity partners with Udacity on Nanodegree program credentials to help you get hired! For more more information see our blog here.

Unity ads wont work on mobile neither on editor

Discussion in 'Unity Ads' started by Dalmar, May 16, 2017.

  1. Dalmar

    Dalmar

    Joined:
    Aug 5, 2013
    Posts:
    10
    It is Always "failed" when I call ShowAds(), on adnroid, ios and editor. Can someone help me?


    Code (CSharp):
    1. using System.Collections;
    2.  using System.Collections.Generic;
    3.  using UnityEngine;
    4.  using UnityEngine.UI;
    5.  #if UNITY_ADS
    6.  using UnityEngine.Advertisements;
    7.  #endif
    8.  
    9.      void Start()
    10.      {
    11.          //Advertisement.Initialize(gameId);
    12.  #if UNITY_ADS
    13.          Advertisement.Initialize(gameId, enableTestMode);
    14.  #endif
    15.          //StartCoroutine(ShowAd());
    16.      }
    17.  
    18.      public void ShowAD(bool reward)
    19.      {
    20.          if (reward)
    21.          {
    22.              ShowRewardedAd();
    23.          }
    24.          else
    25.  
    26.          {
    27.              if (PlayerPrefs.GetInt("canShowAllADS") == 0)
    28.                  ShowAds();
    29.          }
    30.      }
    31.  
    32.  
    33.      private void ShowAds()
    34.      {
    35.          Debug.Log("call ADS");
    36.  #if UNITY_ADS
    37.          while (!Advertisement.IsReady())
    38.          {
    39.              Debug.Log("ADS NOT READY YET");
    40.            
    41.          }
    42.          Advertisement.Show();
    43.  
    44.          Debug.Log("worked");
    45.  #else
    46.          Debug.Log("failed");
    47.        
    48.  #endif
    49.      }
     
    Last edited: May 17, 2017
  2. Dalmar

    Dalmar

    Joined:
    Aug 5, 2013
    Posts:
    10
    I tried to use a snippet to show the code to you but it did not worked =/
     
  3. Rayleigh2116

    Rayleigh2116

    Joined:
    Feb 27, 2014
    Posts:
    262
    yesterday i think there was some problems with unity ads because i lose 90% Revenue
     
    dinhbatri likes this.
  4. rasmus-unity

    rasmus-unity

    Unity Technologies

    Joined:
    Aug 15, 2014
    Posts:
    831
    @Dalmar, what does Console log say when you play in editor. Do you get an Initialize() call?

    /Rasmus
     
  5. dinhbatri

    dinhbatri

    Joined:
    Jun 5, 2014
    Posts:
    8
    same as me, maybe have problem with report Unity ads
     
  6. rasmus-unity

    rasmus-unity

    Unity Technologies

    Joined:
    Aug 15, 2014
    Posts:
    831
    Please some more details in that case. Device log, console log from editor or something more than a "it doesn't work" message on a forum thread ;)

    I've checked server side monitoring, and except for a small "hiccup" around 2pm UTC time yesterday, nothing which should have affected revenue.

    So please share some details, which can help us pinpoint your issues. @Rayleigh2116 and @dinhbatri you are also welcome to contact our support on https://unityads.unity3d.com/help/help/contact if you continue to see this decrease in revenue.

    /Rasmus
     
  7. dinhbatri

    dinhbatri

    Joined:
    Jun 5, 2014
    Posts:
    8
    Thank for you reply, maybe coming from my side, I will check and contact with team support.
    And Could you add earning report today on dashboard ?. Now we only see report yesterday and last 24 hours.
    Thank you.
     
  8. rasmus-unity

    rasmus-unity

    Unity Technologies

    Joined:
    Aug 15, 2014
    Posts:
    831
    Last 24 hours isn't sufficient in that case? What does "today" mean then?
     
  9. dinhbatri

    dinhbatri

    Joined:
    Jun 5, 2014
    Posts:
    8
    that mean, I need know how many earning I got from 0h -> current time today.
    ex: I enter dashboard at 9h am, and I need know how many i got from 0h --> 9h am.
     
  10. Dalmar

    Dalmar

    Joined:
    Aug 5, 2013
    Posts:
    10
    Nothing appers on console log, the code does not run where I put "#if UNITY_ADS" on mobile or editor, the code just ignore it. I know that line just run when the device accept unity ads, so looks like that my device is not accepting it. And I do not get the Initialize() call
     
    Last edited: May 17, 2017
  11. Dalmar

    Dalmar

    Joined:
    Aug 5, 2013
    Posts:
    10
    I tested with
    Code (CSharp):
    1. #if UNITY_ADS
    2. ...
    3. #else
    4. Debug.log("teste");
    and the debug shows on editor. I put it on a text to test on device and it also run only the #else
     
    Last edited: May 17, 2017
  12. Dalmar

    Dalmar

    Joined:
    Aug 5, 2013
    Posts:
    10
    Code (CSharp):
    1. private void ShowAds()
    2. {
    3. Debug.Log("call ADS");
    4. #if UNITY_ADS
    5. while (!Advertisement.IsReady())
    6. {
    7. Debug.Log("ADS NOT READY YET");
    8.  
    9. }
    10. Advertisement.Show();
    11.  
    12. Debug.Log("worked");
    13. #else
    14. Debug.Log("failed");
    15.  
    16. #endif
    17. }
    here the console log shows Call ADS and failed
     
  13. bens0n

    bens0n

    Joined:
    Feb 14, 2014
    Posts:
    33
    I get the error ,
    Assets/AdsController.cs(9,19): error CS0234: The type or namespace name `Advertisements' does not exist in the namespace `UnityEngine'. Are you missing an assembly reference?

    Then I tried to reimport the asset package from the asset store, which fixes the build error, but no ADS are shown in app.
    Also the Advertisements.IsReady() is always false but the Advertisements.IsInitialized() is true
     
    Last edited: May 17, 2017
  14. Dalmar

    Dalmar

    Joined:
    Aug 5, 2013
    Posts:
    10
  15. Dalmar

    Dalmar

    Joined:
    Aug 5, 2013
    Posts:
    10
    Anything?
     
  16. Dalmar

    Dalmar

    Joined:
    Aug 5, 2013
    Posts:
    10
    I'm trying everything that I found online but nothing seens to work.
    No console log erros, the code just ignore "#if UNITY_ADS" Always in any device. I have some resrict deadlines, anyone can help me? I am using a valid game id and the ads is not even initializing =/.