Question by
elasrih215 · Oct 16, 2017 at 06:52 PM ·
parsing error
C# Parsing error ?
using UnityEngine; using System.Collections; using GoogleMobileAds.Api;
public class AdsManager : MonoBehaviour {
public static AdsManager Instance { get; set; }
public bool interstitialloaded = false;
public bool interstitialClosed = false;
const string InterstitialAdId = "ca-app-pub-3940256099942544/1033173712";
const string bannerAdId = "ca-app-pub-3940256099942544/6300978111";
InterstitialAd interstitialAd;
AdRequest request;
private BannerView bannerview;
private void Awake()
{
if (Instance == null)
Instance = this;
else
Destroy (gameObject);
DontDestroyOnLoad (gameObject);
interstitialAd = new InterstitialAd (InterstitialAd);
Showbanner ();
request = new AdRequest.Builder ().Build ();
interstitialAd.LoadAd (request);
}
public void RequestBanner() { bannerview = new BannerView (bannerAdId, AdSize.Banner, AdPosition.Bottom);
AdRequest request = new AdRequest.Builder ().Build ();
bannerview.LoadAd (request);
bannerview.Show ();
}
public void Showbanner()
{
if(bannerview == null)
{
RequestBanner();
}
Debug.Log ("the banner is shown");
}
public void showInterstitial(){
request = new AdRequest.Builder ().Build ();
interstitialAd.LoadAd (request);
if (InterstitialAd.IsLoaded ()) {
interstitialloaded = true;
InterstitialAd.Show ();
print ("loaded and showed interstitial");
} else {
print ("Not Ready Yet");
}
interstitialAd.OnAdClosed += Interstitial_onAdClosed ();
}
private void InterstitialAd_onAdClosed(object sender ,System.EventArgs e){
print ("succes, the ad is closed now");
interstitialloaded = false;
interstitialClosed = true;
}
}
}
Comment
Your answer
Follow this Question
Related Questions
parsing error 1 Answer
How to fix this parsing error? 2 Answers
Need help with this code! 1 Answer
(parsing error) can you help me? 1 Answer