Unity Community


Page 1 of 3 123 LastLast
Results 1 to 20 of 50

  1. Posts
    428

    iAd discussion question

    I am looking into some of the iAd functionality that Unity provides and I was wondering if this is all I have to call in order to have iAd into my game. I know that I have to setup the iAd in the apple development section, but is this all I have to call in Unity to display it?

    Code:  
    1. private var banner : ADBannerView = null;
    2.    
    3. function ShowBanner() {
    4.     while (!banner.loaded && banner.error == null)
    5.         yield;
    6.        
    7.     if (banner.error == null)
    8.         banner.Show();
    9.     else banner = null;
    10. }
    11.  
    12. function OnGUI() {
    13.     GUI.enabled = (banner == null ? true : false);
    14.    
    15.     if (GUILayout.Button("Show Banner")) {
    16.         banner = new ADBannerView();
    17.         banner.autoSize = true;
    18.         banner.autoPosition = ADPosition.Bottom;
    19.         StartCoroutine(ShowBanner());
    20.     }
    21. }

    I wouldn't use a button to display the ad but is this the only call I need to make?


  2. Location
    Sacramento CA, USA
    Posts
    1,590
    It's pretty simple to create an iAd. I haven't tested the specific script you posted, but just glancing over it, it appears like it should work fine. Why don't you test it yourself?


  3. Posts
    428
    I would but I don't have a mac until the weekend. I have to borrow a friends. I just am trying to get all my code figured out before then.


  4. Location
    Huntington Beach, CA, USA
    Posts
    1,054
    That script is from the Script Reference for AdBannerView so I'd expect it to work. I have a button-less version listed here - http://drupal.technicat.com/games/unity/ios/iads.html - but it seems to me that it doesn't refresh the ad after the first one is displayed, so I've filed a bug report.


  5. Posts
    428
    Thanks technicat. Yeah I haven't done much work with ads in my game so I just am unsure on how they actually get displayed. Will this show up in my development version? Or does it only work in published versions?


  6. Location
    Huntington Beach, CA, USA
    Posts
    1,054
    I always see a test ad displayed until the app is approved by Apple.


  7. Posts
    95
    Quote Originally Posted by technicat View Post
    That script is from the Script Reference for AdBannerView so I'd expect it to work. I have a button-less version listed here - http://drupal.technicat.com/games/unity/ios/iads.html - but it seems to me that it doesn't refresh the ad after the first one is displayed, so I've filed a bug report.
    just checking this script will only compile on a mac?


  8. Location
    Lyon, France
    Posts
    47
    @technicat: Does it work for you on iPhone? Because I can display the test ad on my iPad, but there's nothing showing on my iPhone, eventhough my Debug Logs say the opposite...


  9. Posts
    95
    iphone works fine, although the test ad eventually turns into a plain white banner and im not sure if this is normal behaviour


  10. Location
    Lyon, France
    Posts
    47
    Meh I'm gonna check some more then, my banner may be obscured by an error of placement then.


  11. Location
    Huntington Beach, CA, USA
    Posts
    1,054
    @Le_nain It does show up for me on my 4th-gen iPod touch (iOS 5) but will disappear if I suspend and resume - I assume it's the same non-refreshing issue that produces the white banner. @nshack31 re your earlier question, the doc only mentions an implementation of AdBannerView for iAds (and thus, only on iOS) - I would hope the code compiles and does nothing for non-IOS targets but if not, you can just wrap an #if UNITY_IPHONE around it.


  12. Location
    Lyon, France
    Posts
    47

    Fixed

    Found it: the issue relies in the retina display.
    Let me explain in case someone has the same issue someday:

    - First, I'm not using like you guys the autposition/autosize features, because as within my app I manually handle the screen rotations (not using Unity's autorotation because I want to change some settings on my camera/GUI when the screen rotates), it wouldn't autoposition nor autosize my banners.

    - So I was manually positionning my banners, but I was doing it the way it should be handled by Unity: using Screen.height - the Y size of my banner. Here's lies the problem. in fact, Unity just transfers those parameters to native and let it handles the banners. THOUGH, one should know that Apple's SDK handles retina and non-retina displays the exact same way, so even if you're on a retina display device you should use the non-retina display screen sizes to place your banner. (e.g. for iPhone 3 AND iPhone 4, the banner should be placed vertically at 320 - bannerYSize for landscape and 480 - bannerYSize for portrait if you want your banner at the bottom)


  13. Location
    Berlin
    Posts
    284
    Quote Originally Posted by Le_nain View Post
    Found it: the issue relies in the retina display.
    Let me explain in case someone has the same issue someday:

    - First, I'm not using like you guys the autposition/autosize features, because as within my app I manually handle the screen rotations (not using Unity's autorotation because I want to change some settings on my camera/GUI when the screen rotates), it wouldn't autoposition nor autosize my banners.

    - So I was manually positionning my banners, but I was doing it the way it should be handled by Unity: using Screen.height - the Y size of my banner. Here's lies the problem. in fact, Unity just transfers those parameters to native and let it handles the banners. THOUGH, one should know that Apple's SDK handles retina and non-retina displays the exact same way, so even if you're on a retina display device you should use the non-retina display screen sizes to place your banner. (e.g. for iPhone 3 AND iPhone 4, the banner should be placed vertically at 320 - bannerYSize for landscape and 480 - bannerYSize for portrait if you want your banner at the bottom)
    You guys should also keep in mind that fillrate of real ad request is only around 15% depending on the country. So for most countries you will never see an iAd! Only 7 countries are supported. Make sure to support other ad networks if iAd fails to deliver!

  14. Super Moderator
    Location
    Great Britain
    Posts
    9,647
    it's called adwhirl folks and the kindly mr prime31 with his top hat and white gloves is ready to dazzle you
    Currently working with Sony on our new
    PS4 and Vita game in Unity!

    This post is not representative of Simian Squared Ltd


  15. Location
    Berlin
    Posts
    284
    Quote Originally Posted by hippocoder View Post
    it's called adwhirl folks and the kindly mr prime31 with his top hat and white gloves is ready to dazzle you
    Actually every ad network is getting on the mediation layer train, means trying something similar like adwhirl. Prime has also similar solutions to adwhirl. There is also some free stuff in the asset store. I decided to use Prime's MoPub. MoPub gives you the possibility to use other ad networks via http requests so that you don't need to integrate SDKs other than MoPubs. Means less dependencies to third party software and you can easily change the networks via their web interface on the fly.


  16. Posts
    95
    Quote Originally Posted by technicat View Post
    That script is from the Script Reference for AdBannerView so I'd expect it to work. I have a button-less version listed here - http://drupal.technicat.com/games/unity/ios/iads.html - but it seems to me that it doesn't refresh the ad after the first one is displayed, so I've filed a bug report.
    just to confirm this... my app went live but after the first advert it will not refresh correctly. Problem with unity.


  17. Location
    Australia
    Posts
    44
    Quote Originally Posted by nshack31 View Post
    just to confirm this... my app went live but after the first advert it will not refresh correctly. Problem with unity.
    yeah, I'm using the same code and the ads disappear after the first one.. could it just be the buttonless code that Technicat kindly provided is missing something?


  18. Location
    Huntington Beach, CA, USA
    Posts
    1,054
    Quote Originally Posted by masterchafe View Post
    yeah, I'm using the same code and the ads disappear after the first one.. could it just be the buttonless code that Technicat kindly provided is missing something?
    You can compare and try the original code I copied and modified from the AdBannerView documentation in the Scripting REference.


  19. Location
    Australia
    Posts
    44
    Quote Originally Posted by technicat View Post
    You can compare and try the original code I copied and modified from the AdBannerView documentation in the Scripting REference.
    Oh I didnt mean you had introduced a bug with your rewrite or anything
    I should have said: Could there be something that could be added to the buttonless code that wasnt in the documentation to begin with?
    Last edited by masterchafe; 04-10-2012 at 06:00 PM.


  20. Location
    Huntington Beach, CA, USA
    Posts
    1,054
    Quote Originally Posted by masterchafe View Post
    Oh I didnt mean you had introduced a bug with your rewrite or anything
    I should have said: Could there be something that could be added to the buttonless code that wasnt in the documentation to begin with?
    That's a good point (and I just remembered the doc example is conveniently in the original post here). Maybe we have to periodically check AdBannerView properties like error/loaded/visible and call Show again, but that seems pretty complicated (at least compared to how the Prime31 plugin is used). I haven't heard anything back from my bug report, either.

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •