Example #1
0
 void Start()
 {
     print("Started");
     #error Replace with your own ad unit ID and then remove this error.
     GoogleMobileAdsPlugin.CreateBannerView("INSERT_YOUR_AD_UNIT_ID_HERE",
                                            GoogleMobileAdsPlugin.AdSize.SmartBanner,
                                            true);
     print("Created Banner View");
     GoogleMobileAdsPlugin.RequestBannerAd(true);
     print("Requested Banner Ad");
 }
Example #2
0
    void Start()
    {
        // Show a warning when running in the editor. Our Ad libraries require
        // running on a physical device.
        if (Application.isEditor)
        {
            Debug.LogWarning("Ads cannot be displayed in the editor, you must run on an Android or iOS device");
            AdsEnabled = false;
        }

        // Do nothing if we don't want ads.
        if (AdsEnabled == false || UserData.adRemoved)
        {
            this.enabled = false;
            return;
        }

        string extras = "{\"color_bg\":\"AAAAFF\", \"color_bg_top\":\"FFFFFF\"}";

        // Determine which ad space identifier to use, based on the platform.
        string adUnitID;

#if UNITY_IOS
        adUnitID = Settings.instance.admobIOS;
#elif UNITY_ANDROID
        adUnitID = Settings.instance.admobAndroid;
#else
        adUnitID = null;
#endif

        if (string.IsNullOrEmpty(adUnitID))
        {
            Debug.LogError("You must define a valid Ad Unity ID in order to use the GoogleMobileAds plugin!");
        }
        else
        {
            GoogleMobileAdsPlugin.CreateBannerView(adUnitID, GoogleMobileAdsPlugin.AdSize.Banner, BannerAtTop);
            Debug.Log("Created Banner View");

            GoogleMobileAdsPlugin.RequestBannerAd(TestAds, extras);
            Debug.Log("Requested Banner Ad");
        }
    }
 void Start()
 {
     GoogleMobileAdsPlugin.CreateBannerView(PublisherId, GoogleMobileAdsPlugin.AdSize.SmartBanner, true);
     GoogleMobileAdsPlugin.RequestBannerAd(true);
 }