Quantcast
Channel: Questions in topic: "admob"
Viewing all articles
Browse latest Browse all 137

Admob ads not showing in Game,Admob Ads not showing in game

$
0
0
Admob ads not showing in game GameController.cs has following argument to show ads AdsControl.Instance.ShowAds(): AdsControl.cs script as follows using UnityEngine; using System.Collections.Generic; using System.Collections; using UnityEngine.SocialPlatforms; using GoogleMobileAds.Api; using System; public class AdsControl : MonoBehaviour { protected AdsControl () { } private static AdsControl _instance; InterstitialAd Interstitial; public string AdmobID_Android, AdmobID_IOS; public static AdsControl Instance { get { return _instance; } } void Awake () { if (FindObjectsOfType (typeof(AdsControl)).Length > 1) { Destroy (gameObject); return; } _instance = this; MakeNewInterstitial (); DontDestroyOnLoad (gameObject); //Already done by CBManager } public void HandleInterstitialAdClosed (object sender, EventArgs args) { if (Interstitial != null) Interstitial.Destroy (); MakeNewInterstitial (); } void MakeNewInterstitial () { #if UNITY_ANDROID Interstitial = new InterstitialAd (AdmobID_Android); #endif #if UNITY_IPHONE Interstitial = new InterstitialAd (AdmobID_IOS); #endif Interstitial.OnAdClosed += HandleInterstitialAdClosed; AdRequest request = new AdRequest.Builder ().Build (); Interstitial.LoadAd (request); } public void ShowAds () { Debug.Log ("Show ads"); Interstitial.Show (); } public bool GetRewardAvailable () { bool avaiable = false; return avaiable; } public void HideBannerAds () { } public void ShowBannerAds () { } } ,Admob ads mot showing in game although in script have the following argument in Gamemanager.cs AdsControl.Instance.ShowAds(); Adscontrol.cs > using UnityEngine; using> System.Collections.Generic; using> System.Collections; using> UnityEngine.SocialPlatforms; using> GoogleMobileAds.Api; using System;>> public class AdsControl :> MonoBehaviour {>>> protected AdsControl () { }>> private static AdsControl _instance;> InterstitialAd Interstitial; public> string AdmobID_Android, AdmobID_IOS;>>> public static AdsControl Instance {> get { return _instance; } }>> void Awake () { if> (FindObjectsOfType> (typeof(AdsControl)).Length > 1) {> Destroy (gameObject); return;> }>> _instance = this;> MakeNewInterstitial ();>>> DontDestroyOnLoad (gameObject);> //Already done by CBManager>>>> }>>> public void> HandleInterstitialAdClosed (object> sender, EventArgs args) {>> if (Interstitial != null)> Interstitial.Destroy ();> MakeNewInterstitial ();>>>> }>> void MakeNewInterstitial () {>>> #if UNITY_ANDROID Interstitial => new InterstitialAd (AdmobID_Android);> #endif #if UNITY_IPHONE> Interstitial = new InterstitialAd> (AdmobID_IOS); #endif> Interstitial.OnAdClosed +=> HandleInterstitialAdClosed;> AdRequest request = new> AdRequest.Builder ().Build ();> Interstitial.LoadAd (request);>>> }>>> public void ShowAds () { Debug.Log> ("Show ads");>> Interstitial.Show ();>>> }>>> public bool GetRewardAvailable () {> bool avaiable = false;>> return avaiable; }>>> public void HideBannerAds () { }>> public void ShowBannerAds () { }>>> }

Viewing all articles
Browse latest Browse all 137

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>