- Home /
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
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.
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
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.
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.
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?
Your answer
Follow this Question
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