- Home /
Ad mob show like flappy bird when you die? Android?
here's my script and it's working but in all scenes all the time the ad is enabled, a want to make it enabled only when i die that's in other script? how to do it how to call this script? anyhow?
Is the ad script attached to a different gameobject than your dying script?
Answer by sam2k13 · Jan 10, 2015 at 08:08 PM
In your ad script make a public function called ShowAd() that when called will show the ad. You might also want another public function called HideAd() that when called will hide the ad.
Then, in your dying script, make a public GameObject variable called adObject that will hold the GameObject that has your adscript attached to it.
Then by using get component in your dying script you can call the functions in your ad script:
adObject.getComponent<Menu>().ShowAd()
or
adObject.getComponent<Menu>().HideAd()
Your answer
Follow this Question
Related Questions
Inserting mobile ads into Unity games 2 Answers
admob related question 2 Answers
Mobile Ads Frameworks that support unity 0 Answers
Android build error when using Unity Ads 2 Answers