Search Unity

isReady always returns false when trying to get picture ads

Discussion in 'Unity Ads & User Acquisition' started by hamstar, Sep 22, 2014.

  1. hamstar

    hamstar

    Joined:
    Sep 25, 2013
    Posts:
    84
    In editor, and on an Android device, isReady always returns false when trying to use a zoneID which only has picture ads enabled. This is the case even in testMode.

    To test, I changed the pictureZone Ad Type to Video and it immediately began working. If I change the ad type back to Picture, it stops working.

    This is my code. Am I missing something?
    Code (CSharp):
    1.  
    2. void Start() {
    3.     if (Advertisement.isSupported) {
    4.         Advertisement.allowPrecache = true;
    5.         #if UNITY_IPHONE
    6.         Advertisement.Initialize("12345", true);
    7.         #elif UNITY_ANDROID
    8.         Advertisement.Initialize("12346", true);
    9.         #endif
    10.         // this prints in console so I assume everything is ok
    11.         Debug.Log("Advertisement initialized.");
    12.     }
    13.     else {
    14.         Debug.LogWarning("Advertisement not supported.");
    15.     }
    16. }
    17.  
    18. // later on
    19. if (Advertisement.isReady("pictureZone")) {
    20.     Advertisement.Show("pictureZone", new ShowOptions {
    21.         pause = false,
    22.         resultCallback = GameAdsAdvertShown
    23.     });
    24. }
    25. else {
    26.     // this warning is printed in console every time I try to show the advert
    27.     Debug.LogWarning("Advertisement not ready.");
    28. }
    29.  
     
  2. needhamca

    needhamca

    Joined:
    Jul 27, 2014
    Posts:
    9
    I have the same problem. There is another thread where unity devs ask us to rate Unity ads system. I put this as one of my issues. The response was that it could be there are none available for your device/region. Although, my device is a galaxy S5 and my region is US.

    This is the thread.
    http://forum.unity3d.com/threads/unity-ads-reviews.265096/#post-1783037
     
  3. unity-nikkolai

    unity-nikkolai

    Joined:
    Sep 18, 2014
    Posts:
    540
    I was able to verify this in editor. However, I was also able to see the picture ad after building to the device. Have you experienced the same?
     
  4. hamstar

    hamstar

    Joined:
    Sep 25, 2013
    Posts:
    84
    Hi Nikkolai

    isReady returns false for picture ads on my Android device as well (HTC Desire HD). Video ads work on the phone.

    I get a few warnings and errors when starting the game on the device. Some warnings are probabably unrelated as I am using other plugins.
     
  5. unity-nikkolai

    unity-nikkolai

    Joined:
    Sep 18, 2014
    Posts:
    540
    Thanks for the info. Did a bit of research on this yesterday and found a couple things to be aware of.

    In migrating to our new admin, there have been some anomalies with the zone configs. It's possible your's could be missing a "disabled" boolean field in the sever-side zone config. This can quickly be fixed by disabling each of your zones in the Unity Ads Admin panel, and then re-enabling them. Doing so should ad the "disabled" field to each zone in the server side config, which would then be set as false.

    Another thing is we've identified an issue with the pictureZone never returning true for isReady() when running the game in editor. The method does return true when run on the device as long as testMode is set true, the pictureZone is enabled, and Monetization for the game is enabled. For the method to return true while testMode is set false, there needs to be existing picture campaigns to serve up to the application. Right now there aren't any picture campaigns being run, so isReady() would only return false.

    Let me know if you still have trouble seeing picture ads in testMode after toggling the enabled switches in the Admin.
     
  6. Triggles

    Triggles

    Joined:
    Aug 23, 2014
    Posts:
    30
    I toggled the switches, and enabled test mode, and I still don't get picture ads (testing on a Nexus 4, mainly). If I switch to video ads it works, so my code is ok.

    I don't urgently need a fix, as picture ads aren't essential to my project, but I thought you'd like to know.
     
  7. unity-nikkolai

    unity-nikkolai

    Joined:
    Sep 18, 2014
    Posts:
    540
    I can take a look at this on the backend and verify the settings are being saved correctly. Will also run a few tests with a demo script using your gameId in attempt to reproduce the issue you're seeing. Just sent you a private conversation request for your gameId and developerId in order to get started.

    Thanks for sticking with this and reporting it.
     
  8. Triggles

    Triggles

    Joined:
    Aug 23, 2014
    Posts:
    30
    I've sent you my details - thanks for the help, UnityAds is by far the best way to add adverts, so I don't mind ironing a few problems out.
     
  9. unity-nikkolai

    unity-nikkolai

    Joined:
    Sep 18, 2014
    Posts:
    540
    After further research, this issue appears to be due to a missing feature. There is currently no system for showing sample picture ads in your game. If an ad campaign is available for the region you're testing picture ads in, then Unity Ads will serve up that production ad instead of a sample ad while in testMode.

    Unfortunately, this means if no ad campaign is running in your region, you won't be able to properly test the functionality of picture ads in your game until we update the Unity Ads asset package with this feature. Please keep in mind that the option to show picture ads is a relatively new feature, a feature still in beta. This is just one feature we will be adding.

    Thank you all for bringing this up, and for your patience. Definitely much appreciated.
     
  10. Triggles

    Triggles

    Joined:
    Aug 23, 2014
    Posts:
    30
    Thanks for looking into it, much appreciated. As I said, picture ads are simply a bonus for my game, so I can wait. Glad to hear it's solved.
     
  11. hamstar

    hamstar

    Joined:
    Sep 25, 2013
    Posts:
    84
    Hi Nikkolai.

    I just wondered if you can give an indication of the future of picture ads?

    You mention that picture ads are a new feature, and that there aren't many campaigns running at the moment. Do you expect the number of picture campaigns to increase significantly? If so, in the near future, or much later?
     
  12. unity-nikkolai

    unity-nikkolai

    Joined:
    Sep 18, 2014
    Posts:
    540
    Yep. Numbers wise, our target is to have picture ads be on par with our inventory of video ads. Even though some of the implementation features for testing are still in the works, the infrastructure to support picture ads is already in place and we are actively seeking inventory from advertisers. You can expect the number of available picture ad campaigns to gradually increase over the coming weeks and months.
     
  13. hamstar

    hamstar

    Joined:
    Sep 25, 2013
    Posts:
    84
    Thanks Nikkolai that good to know.
     
  14. taxvi

    taxvi

    Joined:
    Feb 18, 2013
    Posts:
    30
    hey there! I'm a bit late over here but still...

    I've read through but my case is a little different - the video ad is displayed on the first request, but after that Advertisment.isReady() returns false. shall I call the Initialize() function after each show? but I think this is more of an ad fill-rate issue because I've worked with other ad servers and that's how it worked. However, here I've never got 2 ads in one session of my game and it's a bit frustrating :/

    could you give us an insight on how does the fill-rate work in UnityAds? or what could I be doing wrong? :/

    thank you!
     
  15. unity-nikkolai

    unity-nikkolai

    Joined:
    Sep 18, 2014
    Posts:
    540
    It could be a fill rate issue. Where are you located geographically?

    You only need to call the Initialize() method once in your game. Whenever you call the isReady() method, Unity Ads checks to see if ads for the the specified zone ID are ready. If no zone is specified, it checks the default.

    When you call the Show() method, you need to be specifying the same zone ID that you specified when calling the isReady() method. If you're not specifying a zone for isReady, you shouldn't specify a zone for Show either.

    Just to make sure this isn't a functionality issue, enable test mode when calling the Initialize() method by passing true as a second parameter after the game ID. If you're able to see multiple test ads without any issue, then we know it's most likely a fill or user valuation/mediation issue when test mode is disabled.

    I'd recommend using something like the following code to configure and initialize Unity Ads. It requires that you enabled Development Build in Build Settings in order to enable test mode. But in doing so, it'll keep you from accidentally releasing your game with test mode still enabled. You also need Development Build enabled in order to see debug levels; they won't be shown otherwise.
    Code (CSharp):
    1. public string gameID;
    2.  
    3. // Development Build must be enabled in Build Settings
    4. //  in order to use test mode and show debug levels.
    5. public bool disableTestMode;
    6. public bool showInfoLogs;
    7. public bool showDebugLogs;
    8. public bool showWarningLogs = true;
    9. public bool showErrorLogs = true;
    10.  
    11. public void ConfigureAndInitializeUnityAds ()
    12. {
    13. #if UNITY_IOS || UNITY_ANDROID
    14.     if (Advertisement.isInitialized)
    15.     {
    16.         Debug.LogWarning("Unity Ads is already initialized.");
    17.        
    18.         return;
    19.     }
    20.    
    21.     Advertisement.debugLevel = Advertisement.DebugLevel.NONE;  
    22.     if (showInfoLogs) Advertisement.debugLevel    |= Advertisement.DebugLevel.INFO;
    23.     if (showDebugLogs) Advertisement.debugLevel   |= Advertisement.DebugLevel.DEBUG;
    24.     if (showWarningLogs) Advertisement.debugLevel |= Advertisement.DebugLevel.WARNING;
    25.     if (showErrorLogs) Advertisement.debugLevel   |= Advertisement.DebugLevel.ERROR;
    26.    
    27.     bool enableTestMode = Debug.isDebugBuild && !disableTestMode;
    28.     Debug.Log(string.Format("Initializing Unity Ads for game ID {0} with test mode {1}...",
    29.                             gameID, enableTestMode ? "enabled" : "disabled"));
    30.    
    31.     Advertisement.Initialize(gameID,enableTestMode);
    32. #else
    33.     Debug.LogError("Unity Ads is not supported under the current build platform.");
    34. #endif
    35. }
     
    Salazar likes this.
  16. taxvi

    taxvi

    Joined:
    Feb 18, 2013
    Posts:
    30
    all right, thanks for the quick reply. I guess I have everything all right in my game. in test mode the demo ads pop up on each request. I'm not specifying ZoneID anywhere at all, just calling default isReady() and Show() functions. Geographically I'm in Georgia - the country, in Caucasus. Why does it matter?

    thank you.
     
  17. unity-nikkolai

    unity-nikkolai

    Joined:
    Sep 18, 2014
    Posts:
    540
    Fill varies depending on what country (or country tier) you're in. There may not be much fill in Georgia.
     
    Salazar likes this.