Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Nominations have been announced for this years Unity Awards. Celebrate the wonderful projects made by your peers this year and get voting! Vote here!
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    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:
    2,829
  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:
    2,829
    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:
      13
  6. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    2,829
    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:
      11
  8. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    2,829
  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.