Turning off adds when a new unity scene is loaded.

38 views
Skip to first unread message

David Knowles

unread,
Sep 20, 2014, 1:30:41 PM9/20/14
to google-adm...@googlegroups.com
Built my first unity game, I built it with Unity Javascript. At the stage of adding ads from Admob, I have manage to get ads working in the game but I can't figure out how to stop ads from displaying in certain scenes. Just wondering how I got about doing it. 

Kunal Verma

unread,
Sep 21, 2014, 1:59:38 AM9/21/14
to Google AdMob Ads Developers


var isPaused:boolean;
public BannerView bannerView;

Assuming you are requesting ad in start().

You can achieve this by adding/appending code below in update() method of javascript which is attached to gameobject inside level ( level which contains ad)

   if(Input.GetKeyDown("escape") && !isPaused)
   {
      
      isPaused = true;
    bannerView.Hide();
     
       
   }
   else if(Input.GetKeyDown("escape") && isPaused)
   {
     bannerView.Show();
      isPaused = false;
          
   } 

 
//And in your pause button, you can have something like this ( if it is a GUI button)

if(GUI.Button(Rect(0,heightofbuttonScreen.width/20Screen.height/20), pauseimagemyButtonStyle1))
 {
 isPaused = true;
 
 }


//Just an example. You can modify it as per your needs.

 Also, add  bannerView.Show() when coming back to this level.




On Sat, Sep 20, 2014 at 11:00 PM, David Knowles <davidk...@gmail.com> wrote:
Built my first unity game, I built it with Unity Javascript. At the stage of adding ads from Admob, I have manage to get ads working in the game but I can't figure out how to stop ads from displaying in certain scenes. Just wondering how I got about doing it. 

--

---
You received this message because you are subscribed to the Google Groups "Google AdMob Ads Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages