Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity ads wont work on mobile neither on editor

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

  1. Dalmar

    Dalmar

    Joined:
    Aug 5, 2013
    Posts:
    14
    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:
    14
    I tried to use a snippet to show the code to you but it did not worked =/
     
  3. MrGky93

    MrGky93

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

    rasmus-unity

    Moderator

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

    /Rasmus
     
  5. trirom1

    trirom1

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

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    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. trirom1

    trirom1

    Joined:
    Jun 5, 2014
    Posts:
    14
    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

    Moderator

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

    trirom1

    Joined:
    Jun 5, 2014
    Posts:
    14
    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:
    14
    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:
    14
    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:
    14
    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. Ankaman

    Ankaman

    Joined:
    Feb 14, 2014
    Posts:
    37
    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:
    14
  15. Dalmar

    Dalmar

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

    Dalmar

    Joined:
    Aug 5, 2013
    Posts:
    14
    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 =/.