Search Unity

Unity Fake ads work great in editor but not on android or even published

Discussion in 'Unity Ads & User Acquisition' started by snowwolfam24, Nov 27, 2018.

  1. snowwolfam24

    snowwolfam24

    Joined:
    Oct 7, 2018
    Posts:
    2
    Testing my game in Editor, the ads work great right where they should be but when exported to my android phone and installed from google play no ads show. Ive tested on a Galaxy Note 8, Samsung S7, samsung s8. I did the Unity guide step by step. I have my script on a prefab called AdBox. I made sure that I pasted mygame ID(hoping it was a simple error). Just seem I cant figure this out. Is it possible Unity ADs take awhile with publishing? Thinking of every possible angle here lol
    Here is my Script:
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.Advertisements;
    using UnityEngine.Monetization;



    public class ADManager : MonoBehaviour
    {
    public static ADManager Instance { get; set; }

    public string placementId = "video";
    public string bannerPlacement = "banner";

    public bool testMode = false;

    #if UNITY_IOS
    public const string gameId = "1234567";
    #elif UNITY_ANDROID
    public const string gameID = "2926214";
    #elif UNITY_EDITOR
    public const string gameID = "1111111";
    #endif



    private void Start()
    {
    Monetization.Initialize(gameID, testMode);
    Advertisement.Initialize(gameID, testMode);
    Instance = this;
    DontDestroyOnLoad(gameObject);
    StartCoroutine(ShowBannerWhenReady());
    }

    IEnumerator ShowBannerWhenReady()
    {
    while (!Advertisement.IsReady("banner"))
    {
    Debug.Log("Banner not ready");
    yield return new WaitForSeconds(0.5f);
    }
    Debug.Log("Showing Banner");
    Advertisement.Banner.Show(bannerPlacement);
    }

    public void ShowDefaultAd()
    {
    #if UNITY_ADS
    if (!Advertisement.IsReady())
    {
    Debug.Log("Ads not ready for default placement");
    return;
    }

    Advertisement.Show();
    #endif
    }



    public void ShowAd()
    {
    StartCoroutine(ShowAdWhenReady());
    }

    public IEnumerator ShowAdWhenReady()
    {
    while (!Monetization.IsReady(placementId))
    {
    Debug.Log("Default ad not ready");
    yield return new WaitForSeconds(0.25f);
    }

    ShowAdPlacementContent ad = null;
    ad = Monetization.GetPlacementContent(placementId) as ShowAdPlacementContent;

    if (ad != null)
    {
    Debug.Log("Showing Default ad");
    ad.Show();
    }
    }

    }
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  3. CannJRB

    CannJRB

    Joined:
    Jan 6, 2016
    Posts:
    9
    I'm having the same issue. Was this problem resolved?
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    What do your device logs show? I trust that you are using the correct gameID, and @snowwolfam24 make sure your code snippet above is not displaying your real gameID (for privacy/security)
     
  5. CannJRB

    CannJRB

    Joined:
    Jan 6, 2016
    Posts:
    9
    Does this log help? I've double checked the Game ID for Google Play Store and it matches my script. I otherwise copied the Implementing Banner ads guide script and it works in the editor but not on any device so far.

    I've done video adds on a previous app and that worked fine. Maybe there is something else that I'm missing because I'm trying to use banner ads.
     

    Attached Files:

    • log.txt
      File size:
      14.7 KB
      Views:
      1,493
  6. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Currently banner ads work in the US and we are rolling out to other countries. In your logs however I don't see anywhere where you are initializing ads. Please place Debug.Log statements in the relevant portions in your app, which will then show in the logs.
     
  7. CannJRB

    CannJRB

    Joined:
    Jan 6, 2016
    Posts:
    9
    This log has more info. Look for things related to SantaNeedsYourHelp. The device has Feet_and_Inches_Calc on it which runs video ads that are working.

    I noticed a warning that says "Could not show banner due to No fill for placement banner." Does this mean that there is no ad available to show?

    This is how I placed Debug.Log statements:
    Code (CSharp):
    1. void Start()
    2.     {
    3.         Debug.Log("In the Start method for UnityAds script");
    4.         Advertisement.Initialize(gameID, testMode);
    5.         StartCoroutine(ShowBannerWhenReady());
    6.     }
    7.  
    8.     IEnumerator ShowBannerWhenReady()
    9.     {
    10.         Debug.Log("In the Coroutine for UnityAds script");
    11.         while (!Advertisement.IsReady("banner"))
    12.         {
    13.             Debug.Log("In the While loop for UnityAds script");
    14.             yield return new WaitForSeconds(0.5f);
    15.         }
    16.         Debug.Log("After the While loop for UnityAds script");
    17.         Advertisement.Banner.Show(bannerPlacement);
    18.     }
     

    Attached Files:

    • log.txt
      File size:
      152.3 KB
      Views:
      887
  8. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  9. CannJRB

    CannJRB

    Joined:
    Jan 6, 2016
    Posts:
    9
    I downloaded "Unity Monetization 3.0" from the asset store when I started this project. If I try to download again, it says "Nothing to import!"

    I've been toggling back and forth on Production and Test Mode trying to get something to work. If in test mode, will I see a gray box that says "This would be your banner" on the android device?
     
  10. CannJRB

    CannJRB

    Joined:
    Jan 6, 2016
    Posts:
    9
    There are two apps on that device so the older app may be using 2.1.1. See this line from the log:
    12-06 15:51:15.450 19055 19074 I UnityAds: com.unity3d.services.UnityServices.initialize() (line:79) :: Initializing Unity Services 3.0.0 (3000) with game id #####29 in production mode
     
  11. CannJRB

    CannJRB

    Joined:
    Jan 6, 2016
    Posts:
    9
    It worked for the first time today, but only once. It looks like there just aren't ads available to display. I'm in the US so I thought that wouldn't be a problem.
     
  12. pixel375

    pixel375

    Joined:
    Dec 2, 2018
    Posts:
    9
    Had the same issue, had to switch to another network. If you do end up getting this to work, please let us know
     
  13. CannJRB

    CannJRB

    Joined:
    Jan 6, 2016
    Posts:
    9
    I've seen your posts on the forum. I think I'll be switching to another platform, too.
     
  14. pixel375

    pixel375

    Joined:
    Dec 2, 2018
    Posts:
    9
    I am by no means trying to make Unity lose customers, but if that's what it takes to improve banner ads.. lol
    I am currently trying Facebook Audience Network, and StartApp.

    I had a hell of a time trying to implement FAN banners, especially due to no customer support, and a low activity support group. Finally got it implemented, but my apps CPM is only like $0.30 at the moment.. Hope that goes up as more people use it.

    StartApp was super easy to implement, but after 80 impressions, and 10 clicks at 100% fill rate, there was $0 earnings, not sure if that aswell would go up within time or not, but either way, I will stay with FAN for a month and see if it's worth it.

    Really hoping Unity banner ads improve soon.
     
  15. kyleshell

    kyleshell

    Joined:
    Jul 28, 2017
    Posts:
    10
    Yeah, similar issue here with 2018.3. Unity banner ads show as intended in the editor. It seems the banners do load eventually, so I assume the issue is with the ad server and not the implementation code. I really hope Unity prioritizes this issue. I know it's early for Unity's banner implementation, so maybe they don't have enough advertisers, but the same activity is identical for test ads. Can take anywhere from 1 second to multiple minutes before the banner shows if it even does at all, and by then, the players have already moved on to the next screen. It's wildly inconsistent on the load times when the entire point of a banner ad is to serve it quickly. Thanks for the recommendations on other services.
     
  16. Bgurg

    Bgurg

    Joined:
    Nov 12, 2017
    Posts:
    2
    Well the issue can be solved just go to your unity dashboard and select the game or project you published or publishing then go to Ads then placement where you can find in the ads option that ask for "forced to disable test ads" click yes then no Test Ads will be going to show on your game or app Unity will show the real Ads to your customer. Hope this will help you.
     
  17. impheris

    impheris

    Joined:
    Dec 30, 2009
    Posts:
    1,667
    Hi, are you happy with FAN?

    I'm trying with this unity ads, it works in editor but no working on android devices, (for these days that type of errors should be solved) On the other hand Admob support suks, so simple, I want to try with FAN
     
  18. MolhamM

    MolhamM

    Joined:
    Jan 26, 2018
    Posts:
    4
    Hey , I'm having the same issue
    ONLY IN BANNER ADS (video is working)
    so this is my code , also the device unity log
    so what should I do ?

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.Monetization;
    5. public class UnityAdManger : MonoBehaviour
    6. {
    7.     public static UnityAdManger Instance;
    8.  
    9.     private string storeID = "******";
    10.     private string bannerAd = "Banner";
    11.     private string videoAd = "video";
    12.     private string rewardedVideoAd = "rewardedVideo";
    13.  
    14.     private void Awake()
    15.     {
    16.         if (Instance == null)
    17.         {
    18.             Instance = this;
    19.             DontDestroyOnLoad(Instance);
    20.         }
    21.         else
    22.         {
    23.             Destroy(gameObject);
    24.         }
    25.         Monetization.Initialize(storeID,true);
    26.     }
    27.     void Start()
    28.     {
    29.         RequestBannerUnityAd();
    30.     }
    31.  
    32.     // Update is called once per frame
    33.     void Update()
    34.     {
    35.         RequestBannerUnityAd();
    36.     }
    37.     public void RequestBannerUnityAd()
    38.     {
    39.         print("Requested baner ad");
    40.         if (Monetization.IsReady(bannerAd))
    41.         {
    42.             print("banner ad is ready");
    43.             ShowAdPlacementContent ad;
    44.             ad = Monetization.GetPlacementContent(bannerAd) as ShowAdPlacementContent;
    45.             if (ad != null)
    46.             {
    47.                 print("showing banner ad");
    48.                 ad.Show();
    49.             }
    50.         }
    51.     }
    52.     public void RequestUnityVideoAd()
    53.     {
    54.         print("Requested video ad");
    55.         if (Monetization.IsReady(videoAd))
    56.         {
    57.             print("video ad is ready");
    58.             ShowAdPlacementContent ad;
    59.             ad = Monetization.GetPlacementContent(videoAd) as ShowAdPlacementContent;
    60.             if(ad != null)
    61.             {
    62.                 print("showing video ad");
    63.                 ad.Show();
    64.             }
    65.         }
    66.     }
    67.     public void RequestUnityRewardedVideoAd()
    68.     {
    69.         if (Monetization.IsReady(rewardedVideoAd))
    70.         {
    71.             ShowAdPlacementContent ad;
    72.             ad = Monetization.GetPlacementContent(rewardedVideoAd) as ShowAdPlacementContent;
    73.             if (ad != null)
    74.             {
    75.                 ad.Show();
    76.             }
    77.         }
    78.     }
    79. }
    80.  
     

    Attached Files:

    • 1.PNG
      1.PNG
      File size:
      45.1 KB
      Views:
      824
    • 2.PNG
      2.PNG
      File size:
      39.5 KB
      Views:
      879
    Last edited: Mar 3, 2019
  19. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    Same issue here. There's always an issue with Unity of late.
     
    xpxilom and KingKRoecks like this.
  20. alex1st1

    alex1st1

    Joined:
    Jan 26, 2019
    Posts:
    275
    Archviz3d likes this.
  21. willisuh

    willisuh

    Joined:
    Nov 4, 2015
    Posts:
    15
    what do you mean wheres disable test ads?

    also banner ads dont show in south korea?
     
  22. VrGamesDev

    VrGamesDev

    Joined:
    May 7, 2018
    Posts:
    65
    I am having the same issue.

    It worked once and then it just stopped working. I have the following error:

    2019/08/18 01:45:35.921 26187 26547 Error UnityAds: com.unity3d.services.core.api.Sdk.logError() (line:57) :: No fill for placement Banner


    any Fix?
     
  23. VrGamesDev

    VrGamesDev

    Joined:
    May 7, 2018
    Posts:
    65
    I selected the "override client test mode -> ON" and I get the test unity banner

    https://unityads.unity3d.com/help/unity/integration-guide-unity#banner-ads

    Testing

    Prior to publishing your game, enable test mode by following these steps:

    1. From the Operate tab of the Developer Dashboard, select your Project.
    2. Select Settings > Project Settings from the left navigation bar.
    3. Scroll down to the Test mode section and click the edit button on a platform(Apple App Store or Google Play Store), check Override client test mode box, then select the Force test mode ON radio button.
    In the Unity Editor, click the play button to run your Project and test your ads implementation.

    Note: You must enable test mode before testing ads integration, to avoid getting flagged for fraud.
     
  24. resurrectiondesign

    resurrectiondesign

    Joined:
    Jan 20, 2017
    Posts:
    3
    Is Unity banner ads available in india??? because when in test mode both my video ads and banner ads works but when published only my real video ads shows up.
     
  25. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @resurrectiondesign

    Banner ads are available globally, but we are still ramping up in terms of inventory, so there are not always ads available in some regions.
     
  26. Le-Tux

    Le-Tux

    Joined:
    Feb 12, 2020
    Posts:
    4
    Is there Banner ADS in Switzerland ? In build-it version I can't get a Banner ADS, only video.
     
  27. singlearrowgames

    singlearrowgames

    Joined:
    Oct 14, 2018
    Posts:
    5
    I have published a game on googleplay that uses Unity rewarded ads. Once the player dies, they have an option of reviving by watching a rewarded ad. However when I try this, the ad shows only 3 or 4 times and then nothing happens after that(when I click the revive button). Here is the ad manager script:


    string GooglePlay_ID = "123456";
    bool test_mode = false;
    string myPlacementId = "rewardedVideo";

    void Start()
    {
    Advertisement.AddListener(this);
    Advertisement.Initialize(GooglePlay_ID, test_mode);
    }

    public void DisplayVideoAD()
    {
    Advertisement.Show(myPlacementId);
    }

    public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
    {

    if (showResult == ShowResult.Finished)
    {
    GameManager.instance.ReceiveReward();
    }
    else if (showResult == ShowResult.Skipped)
    {

    }

    else if (showResult == ShowResult.Failed)
    {
    Debug.LogWarning("The ad did not finish due to an error.");
    }
    }

    public void OnUnityAdsReady(string placementId)
    {

    if (placementId == myPlacementId)
    {

    }
    }

    public void OnUnityAdsDidError(string message)
    {

    }

    public void OnUnityAdsDidStart(string placementId)
    {

    }


    Here is the ReceiveReward() function that's in the game manager. This function seems to work fine as after clicking the button, the game restarts with the score before the player died.


    public void ReceiveReward()
    {
    savedScore = (int)playerScore;
    UpdateUI(GameStates.Start);
    SceneManager.LoadScene(1);
    }


    I'm not sure what's going wrong as the ads work a few times...Can someone please help?
     
  28. manurocker95

    manurocker95

    Joined:
    Jun 14, 2016
    Posts:
    210
    Banner won't show up in Spain with Unity Ads. However, rewarded and interstitial work. Any clue?
     
  29. kyle-unity

    kyle-unity

    Unity Technologies

    Joined:
    Jan 6, 2020
    Posts:
    336
    @manurocker95 Can you check the device logs? If banner ads aren't working, there should be an error message saying what went wrong. If you see "No Fill" then it means there aren't any banners available.
     
  30. manurocker95

    manurocker95

    Joined:
    Jun 14, 2016
    Posts:
    210
    No errors are logged at all. In fact, ads are initialized because when using Quantum Console to display logs in build, it shows a custom log I use to check when ads are initialized.. Excepting that, no error nor weird logs at all. Test Mode ones are shown only in editor.
     
  31. kyle-unity

    kyle-unity

    Unity Technologies

    Joined:
    Jan 6, 2020
    Posts:
    336
    Can you post the full logs? The Unity Ads SDK doesn't log events with the same tag as log events in your game so it's possible Quantum Console isn't showing everything.
     
  32. salchicha_loca

    salchicha_loca

    Joined:
    Feb 20, 2018
    Posts:
    3
    Hi, in the internal test and the alpha test and the beta test is normal the fake unity ads not showing rigth?

    I have an internal test app and IAP works fine but rewardVideo button not work nothing happend.
    I have in the dashboard "Force test mode ON (i.e. use test ads) for all devices" because I dont want to be flag for fraud.

    Thank you sorry for my bad english.
     
  33. kyle-unity

    kyle-unity

    Unity Technologies

    Joined:
    Jan 6, 2020
    Posts:
    336
    You should be seeing the test ads if test mode is forced on. It sounds like there might be a problem with your integration. Could you post the code you're using to show ads?
     
  34. Kameswar

    Kameswar

    Joined:
    Aug 15, 2020
    Posts:
    2
    I'm also having same problem. If I change the testmode to true it shows unity test ad. If I change it to false it doesn't show production ads. I want to upload my game tomorrow that's why I check the game by changing the test mode to false.
     
  35. kyle-unity

    kyle-unity

    Unity Technologies

    Joined:
    Jan 6, 2020
    Posts:
    336
    Can you post the code you're using?
     
  36. Kam_Games

    Kam_Games

    Joined:
    Sep 13, 2020
    Posts:
    2
    Two days before it's worked for few times and again it's not working
     
  37. Kam_Games

    Kam_Games

    Joined:
    Sep 13, 2020
    Posts:
    2
    This is my codes.
     
  38. kyle-unity

    kyle-unity

    Unity Technologies

    Joined:
    Jan 6, 2020
    Posts:
    336
    That code looks correct and should be showing Production ads. And you say it was working two days ago? Did you update your game or did it suddenly start showing test ads without an update?
     
  39. xpxilom

    xpxilom

    Joined:
    Aug 28, 2014
    Posts:
    30
    Same problem around here, any solution?
     
  40. Kameswar

    Kameswar

    Joined:
    Aug 15, 2020
    Posts:
    2
    Two days before it's worked for few times and again it's not working. Wait I will send you
    Yes I update SDK through android studio and set the path and it's worked for first time.
    And I update android app bundle version for Google play then it's not show any ads again.
     
    Last edited: Oct 6, 2020
  41. sf27blll

    sf27blll

    Joined:
    Oct 9, 2020
    Posts:
    3
    Yeah me too it worked once then it stopped suddenly and it just for banner ads
     
    VrGamesDev likes this.
  42. unity_T1WL1huamuCWSQ

    unity_T1WL1huamuCWSQ

    Joined:
    Jun 18, 2019
    Posts:
    10
    I can see the banner ad in test mode but not Interstitial. Is there any reason? How can I be sure if the Interstitial ad is working in test mode? in the editor, it looks fine.

    Code (CSharp):
    1. public class UnityAdManager : MonoBehaviour, IUnityAdsListener
    2. {
    3.     public string gameId = "******";
    4.     public string bannerplacementId = "bannerid";
    5.     public string interstialplacementID = "interstialid";
    6.     public bool testMode = true;
    7.     void Start()
    8.     {
    9.         Advertisement.AddListener(this);
    10.      
    11.         Advertisement.Initialize(gameId, testMode);
    12.     }
    13.  
    14.     public void ShowBanner(BannerPosition pos)
    15.     {
    16.         StartCoroutine(ShowBannerWhenReady(pos));
    17.     }
    18.  
    19.     IEnumerator ShowBannerWhenReady(BannerPosition pos)
    20.     {
    21.         while (!Advertisement.IsReady(bannerplacementId))
    22.         {
    23.             yield return new WaitForSeconds(0.5f);
    24.         }
    25.         Debug.Log("ShowBannerWhenReady");
    26.         Advertisement.Banner.SetPosition(pos);
    27.         Advertisement.Banner.Show(bannerplacementId);
    28.      
    29.      
    30.     }
    31.  
    32.  
    33.     public void ShowAd()
    34.     {
    35.         StartCoroutine(ShowAdCO());
    36.     }
    37.     IEnumerator ShowAdCO()
    38.     {
    39.         if (!Advertisement.isShowing)
    40.         {
    41.             while(!Advertisement.IsReady(interstialplacementID))
    42.             {
    43.                 Debug.Log("UNITY interstial ad is not ready. Waiting .5 seconds");
    44.                 yield return new WaitForSeconds(.5f);
    45.             }
    46.             Advertisement.Show(interstialplacementID);
    47.         }
    48.     }
    49.    
    50.     // Implement IUnityAdsListener interface methods:
    51.     public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
    52.     {
    53.         // Define conditional logic for each ad completion status:
    54.         if (showResult == ShowResult.Finished)
    55.         {
    56.             // Reward the user for watching the ad to completion.
    57.             Debug.Log("UNITY ADS COMPLETE");
    58.         }
    59.         else if (showResult == ShowResult.Skipped)
    60.         {
    61.             // Do not reward the user for skipping the ad.
    62.             Debug.Log("UNITY ADS Skipped");
    63.         }
    64.         else if (showResult == ShowResult.Failed)
    65.         {
    66.             Debug.Log("UNITY ADS Failed");
    67.         }
    68.     }
    69.  
    70.     public void OnUnityAdsReady(string placementId)
    71.     {
    72.         Debug.Log("UNITY ADS READY" + placementId);
    73.  
    74.     }
    75.     public void ShowBannerAgain()
    76.     {
    77.         if (Advertisement.IsReady(bannerplacementId))
    78.         {
    79.             Advertisement.Banner.Show(bannerplacementId);
    80.         }
    81.      
    82.     }
    83.  
    84.     public void OnUnityAdsDidError(string message)
    85.     {
    86.         // Log the error.
    87.         Debug.Log("UNITY ADS " + message);
    88.  
    89.     }
    90.  
    91.     public void OnUnityAdsDidStart(string placementId)
    92.     {
    93.         Debug.Log("OnUnityAdsDidStart "+placementId);
    94.     }
    95. }
     
  43. gamedevsatyam

    gamedevsatyam

    Joined:
    Nov 9, 2019
    Posts:
    2
    Forget banner , my video Ads are not working when built and used in device and even after publishing on play store. it just works in editor..... and only if test mode is enabled. when i am ready to publish my game...i disable test mode and end up, resulting no ads on screen....did anyone found the solution ... plss help?!
     
  44. arpitviradiya007

    arpitviradiya007

    Joined:
    Nov 6, 2020
    Posts:
    1
    unity ads are suck!!
     
    mrb12126 and Kam_Games like this.
  45. RudReyEntt

    RudReyEntt

    Joined:
    Nov 29, 2020
    Posts:
    1
    I am facing same issue. I am integrating rewarded video in my game. It works well in editor, but no ads on android device. Have been struggling for 1 week now. I think Unity does not have Ads to display. That seems to be the issue. May be their fill rate is too less or 0 in india. If someonefrom India getting rewarded Ads please guide me. This is my first test game and I do not want to get demotivated because of this issue.
     
  46. stinger3004

    stinger3004

    Joined:
    Nov 26, 2020
    Posts:
    2
    Ya that seems to be the problem. I just published the game to play store, and if i use a vpn i seee the ads, but if i dont use vpn, then ads dont work. This is sad.
     
  47. kyle-unity

    kyle-unity

    Unity Technologies

    Joined:
    Jan 6, 2020
    Posts:
    336
    Hey folks, there is an ongoing issue with some Indian internet providers where the Unity Ads servers aren't reachable. Our engineers investigated this and determined the problem was on the side of the Indian ISPs, so unfortunately there is nothing we can directly do to fix the issue.

    We're working hard to help the affected ISPs resolve the problem. Sorry for the inconvenience.
     
  48. nikhilkhambhaliya4

    nikhilkhambhaliya4

    Joined:
    Jun 30, 2022
    Posts:
    1
    The issue is still there , i got the same situation that real ads are not showing , and the test ads are showing only on editor
     
  49. xxmohammadmbbmxx

    xxmohammadmbbmxx

    Joined:
    Apr 24, 2021
    Posts:
    29
    Same! I've been struggling for 3 days.