title: Simple Unity game gets slow after admob integration
body: <p>I made a simple 2d game with not many objects and it runs fine on my Xperia ST. But when i integrated admobs to show both banner and interstitial ads on game over screen the gameplay lags and gets slow.</p>
  
  <p>My code for admob and how they are used is given below</p>
  
  <p>Player Script</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  
  public class PlayerMotion : MonoBehaviour {
  
  public GameObject gameOverTag,spawner,camera,adObject;
  SpawnScript spawnScript;
  GoogleMobileAdsDemoScript adScript;
  // Use this for initialization
  void Awake() {
      adObject=GameObject.Find("Ads");// ads is a game object which was kept from main menu screen
      }
  
  void Start () {
      spawnScript= spawner.GetComponent&lt;SpawnScript&gt; ();
      //adScript=camera.GetComponent&lt;GoogleMobileAdsDemoScript&gt; ();//GoogleMobileAdsDemoScript is         the ad script
      adScript=adObject.GetComponent&lt;GoogleMobileAdsDemoScript&gt; ();
      adScript.hideBanner ();
      adScript.requestInterstitial ();
  }
  // Update is called once per frame
  void Update () {
  //some more code
              }
      }
  public void Movement()
  {
      //some code
  }
  
  void OnCollisionEnter2D(Collision2D other){
      //some code
  }
  void OnGUI(){
              if (gameOver) {
                      if((adScript.timesInterstitalRequested)%5==0)
                      adScript.ShowInterstitial ();
                      else
                      adScript.showBanner ();
  
                      //some more code
              }
      }
  }
  </code></pre>
  
  <p>Here is GoogleMobileAdsDemoScript Code</p>
  
  <pre><code>using System;
  using UnityEngine;
  using GoogleMobileAds;
  using GoogleMobileAds.Api;
  
  // Example script showing how to invoke the Google Mobile Ads Unity plugin.
  public class GoogleMobileAdsDemoScript : MonoBehaviour
  {
  
  private BannerView bannerView;
  private InterstitialAd interstitial;
  public int timesBannerRequested=0,timesInterstitalRequested=0;
  
  void Awake() {
      DontDestroyOnLoad (this);
  }
  void Start()
  {
  
  }
  
  public void requestBanner(){
      //Requesting BannerView
      timesBannerRequested = timesBannerRequested + 1;
      #if UNITY_EDITOR
      string adUnitId = "ca-app-pub-asdas";
      #elif UNITY_ANDROID
      string adUnitId = "ca-app-pub-asd";
      #elif UNITY_IPHONE
      string adUnitId = "INSERT_IOS_BANNER_AD_UNIT_ID_HERE";
      #else
      string adUnitId = "unexpected_platform";
      #endif
      bannerView = new BannerView(adUnitId, AdSize.SmartBanner, AdPosition.Bottom);
      AdRequest requestBanner = new AdRequest.Builder().Build();
      bannerView.LoadAd(requestBanner);
      //bannerView.Hide ();
  }
  
  public void requestInterstitial(){
      timesInterstitalRequested = timesInterstitalRequested + 1;
      //Requesting Interstitial
      #if UNITY_EDITOR
      string adUnitIdInterstitial = "ca-app-pub-dfada";
      #elif UNITY_ANDROID
      string adUnitIdInterstitial = "ca-app-pub-asdas";
      #elif UNITY_IPHONE
      string adUnitIdInterstitial = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE";
      #else
      string adUnitIdInterstitial = "unexpected_platform";
      #endif
      interstitial = new InterstitialAd(adUnitIdInterstitial);
      AdRequest requestInterstitial = new AdRequest.Builder().Build();
      interstitial.LoadAd(requestInterstitial);
  }
  
  public void showBanner()
  {
      bannerView.Show ();
  }
  public void destroyBanner()
  {
      bannerView.Destroy ();
      }
  
  public void hideBanner()
  {
      bannerView.Hide ();
      }
  public void ShowInterstitial()
  {
      if (interstitial.IsLoaded())
      {
          interstitial.Show();
      }
      else
      {
          print("Interstitial is not ready yet.");
      }
  }
  }
  </code></pre>