Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

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

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

  1. snowwolfam24

    snowwolfam24

    Joined:
    Oct 7, 2018
    Posts:
    1
    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

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,121
  3. CannJRB

    CannJRB

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

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,121
    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:
      188
  6. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,121
    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:
      147
  8. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,121
  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:
    9
    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:
    352
    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:
      78
    • 2.PNG
      2.PNG
      File size:
      39.5 KB
      Views:
      76
    Last edited: Mar 3, 2019
  19. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    1,999
    Same issue here. There's always an issue with Unity of late.
     
  20. alex1st1

    alex1st1

    Joined:
    Jan 26, 2019
    Posts:
    30
    Archviz3d likes this.