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 hunter_Abraham · Oct 20, 2014 at 01:48 PM · androiddontdestroyonloadad

Keep ads alive even when applicationLoad is called

When applicationLoadLevel is called everything gets destroyed but when i use dontdestroy(gameobject) Gameobject "ads" keeps increasing and never calls the ad? My game is in store the only thing is ads are not working I used Shane O'breins youtube video to integrate ads... Thanks!, Help me out with the ad! P.s It for android Devices I'm using admobs and Im trying an interstitial ad i code in C# Thanks

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by HarshadK · Oct 20, 2014 at 01:48 PM

As I understand in each of your scene your gameobject for ad which you set as DontDestroyOnLoad is instantiated.

For this you can use following script:

 NameOfYourScript instance = null;
 
 void Awake()
 {
     if(instance == null)
     {
         instance = this.instance;
         DontDestroyOnLoad(this.GameObject);
     } else if(instance != this.instance)
     {
         Destroy(this.gameObject);
     }
 }

All this script does is creates an instance and keeps it throughout. Whenever a new instance is created and there is already present then destroy this new instance.

Comment
Add comment · Show 7 · 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 hunter_Abraham · Oct 20, 2014 at 01:58 PM 0
Share

I think this is perfect and im trying an interstitial app so it takes a while to load as you know so how do I instantiate the Interstitial ad quickly and do i have to request it everytime to get different ads or just once

avatar image HarshadK · Oct 20, 2014 at 02:00 PM 0
Share

The plugin will take its own sweet time to instantiate the ads. Plus you need to call show ad each time you want to show an interstitial ad.

avatar image hunter_Abraham · Oct 20, 2014 at 02:23 PM 0
Share

i was thinking to call it at void start and enable it when it is supposed (with a in game event) to so that it loads already and opens it when i call the enable.

avatar image HarshadK · Oct 20, 2014 at 02:24 PM 0
Share

Yes, you can do that. :-)

avatar image hunter_Abraham · Oct 20, 2014 at 03:33 PM 0
Share

But will that only send the same ad everytime or will it change the ads because its requesting only once but its enabling it many times? Or should I code something else so that I could call the ad request in certain intervals?

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Implementing AdMob into Android Mobile Games 1 Answer

Full screen Admob ads? 2 Answers

Can't get ads in my Android app 0 Answers

Inner-active mobile ads for Android 0 Answers

How to set view to transparent on android 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