コード例 #1
0
        public void ShowBanner(string bannerName, Vector2 position)
        {
            if (bannerName == null)
            {
                bannerName = "SimpleBanner";
            }
            if (position == null)
            {
                position = default;
            }


            //remove old banner
            _admob.removeBanner(bannerName);


#if UNITY_ANDROID
            string adId = testMode ? _testAds[0].id : androidAds[0].id;
#elif UNITY_IPHONE
            string adId = testMode? _testAds[0].id : iosAds[0].id;
#else
            string adId = "unexpected_platform";
#endif

            //Show new banner
            //_admob.showBannerAbsolute(adId, AdSize.SMART_BANNER, (int)position.x, (int)position.y, bannerName);
            _admob.showBannerRelative(adId, admob.AdSize.SMART_BANNER, admob.AdPosition.BOTTOM_CENTER, 0, bannerName);

            Debug.Log($"Banner '{bannerName}' shown.");
        }