Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by John Sartain · Mar 19, 2014 at 04:22 AM · adsadmobinitialize

Admob ads display on all scenes

Im using this javascript in a prefab ads work but display in all scenes which is annoying i only want it on the menu and credits. btw i xed my publisher id sorry if the codes appears funny idk why it does that

pragma strict

var publisherId : String = "xxxxxxxxxxxxxxx"; var refreshRate : float = 60.0; var testDevice : String = "test_device_code_here"; function Start () { AdBannerObserver.Initialize(publisherId, testDevice, refreshRate); }

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Dblfstr · Mar 19, 2014 at 07:53 PM 0
Share

Format code by highlighting all your code and clicking the little box that looks like a bunch of 1's and 0's.

  #pragma strict 
     
     var publisherId : String = "xxxxxxxxxxxxxxx"; 
     var refreshRate : float = 60.0; 
     var testDevice : String = "test_device_code_here";
 
     function Start () { 
          AdBannerObserver.Initialize(publisherId, testDevice, refreshRate); 
     }
avatar image Dblfstr · Mar 19, 2014 at 07:56 PM 0
Share

Also, is this the same question?

http://answers.unity3d.com/questions/654910/admob-ads-work-but-are-on-all-scenes.html

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by supernat · Mar 19, 2014 at 05:41 AM

The way Unity works is with a single Activity view, and it implements a GL view to render the game scenes. It doesn't matter what scene you are showing in Unity, the same activity is used. You didn't post the rest of your code for AdMob, or maybe you're using a library, but you will need to add a couple of methods, one to Show the banners and one to Hide the banners. Like Unity, the AdMob banners will be in their own Activity that persists no matter what unity scene is showing. Your Show method should start the AdMob activity while your Hide method should stop or simply hide the AdMob activity.

Comment
Add comment · Show 9 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image John Sartain · Mar 19, 2014 at 06:13 AM 0
Share

Could u give me an example

avatar image supernat · Mar 19, 2014 at 06:04 PM 0
Share

Unfortunately I can't. We're talking about a significant amount of code and completely dependent on what you are using now. There's no simple "drop in" script fragment for this.

avatar image John Sartain · Mar 19, 2014 at 07:24 PM 0
Share

Sorry I'm a noob but would it be something like Function show(){ If scene == blah; Admob.hide; } As far as I know this is all the code attached to prefab ya there's manifest and the .j files

avatar image Dblfstr · Mar 19, 2014 at 07:48 PM 0
Share

It's not that simple. Whatever you are using to access admob ads, surely relies on some sort of library which contain the actual admob code. Your prefab and script will simply call that one method in the admob class (create an ad). There would need to be a show and/or hide method in that admob class in order for you to call it for your ads.

Is this a free plugin, did you write it following one of the many tutorials on the subject? Is this for android.

There is a great plugin that has all the functionality you desire called android native plugin. It is $30.00, but WELL worth it. I have used it in my android games, if your game is decent you will make you money back in a week at the most.

Here is a link: https://www.assetstore.unity3d.com/#/content/10825

avatar image Dblfstr · Mar 19, 2014 at 08:06 PM 0
Share

Saw you old question (same question). There seems to be the method for hiding ads.

https://github.com/googleads/googleads-mobile-plugins/tree/master/unity/android

 Google$$anonymous$$obileAdsPlugin.HideBannerView();
Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

23 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Google AdMob implementation problems 1 Answer

Buttons don't work with AdMob 1 Answer

google ad mob display ad on canvas 0 Answers

In dire need of help with integrating ads into my game 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges