- Home /
Question by
SonicDirewolf · Nov 15, 2017 at 03:17 PM ·
adsadmobadvertisingbanner
Displaying Admob's banner ad in game scene
I have two scenes. Menu and Game. I want a banner ad to always stay on screen only and only during the game scene. How can I do this? This is the ad script
public class AdManager : MonoBehaviour {
public static AdManager Instance{ set; get; }
public string bannerId;
public string videoId;
// Use this for initialization
private void Start () {
Instance = this;
DontDestroyOnLoad (gameObject);
#if UNITY_EDITOR
#elif UNITY_ANDROID
Admob.Instance().setTesting(true);
Admob.Instance ().initAdmob (bannerId, videoId);
#endif
}
// Update is called once per frame
void Update () {
}
public void ShowBanner(){
#if UNITY_EDITOR
#elif UNITY_ANDROID
Admob.Instance ().showBannerRelative (AdSize.Banner, AdPosition.TOP_CENTER, 0);
#endif
}
}
To show the banner I am using : AdManager.Instance.ShowBanner (); Thank You
Comment
Your answer
Follow this Question
Related Questions
Can we show 3d ads in the game like on billboards? 0 Answers
Admob banner not showing up? 2 Answers
Regarding Admob Banner Ads position and game layout? 0 Answers
Tiny Banner Ad problem? 1 Answer