Quantcast
Channel: Questions in topic: "ads"
Viewing all articles
Browse latest Browse all 1416

I can't get variable to decrease by one

$
0
0
This is probably a very easy question to answer, but for some reason, I can't figure out what is wrong. I want my int showAd to decrease by one every time the Canvas1 is enabled. Here is code: using System.Collections; using System.Collections.Generic; using UnityEngine; using GoogleMobileAds.Api; public class AdManager : MonoBehaviour { //public bool dead; public int showAd = 3; public InterstitialAd interstitial; public BannerView bannerView; public bool canShowInt; void Start () { RequestBanner (); RequestInterstitial (); } void Awake () { DontDestroyOnLoad (this); } void Update () { if (GameObject.Find ("Canvas1").GetComponent ().enabled == true) { canShowInt = true; } else { canShowInt = false; } if (showAd == 0) { showAd = 3; } } void ShowInterstitial () { if (canShowInt == true) { showAd = showAd - 1; if (showAd == 0) { if (interstitial.IsLoaded ()) { interstitial.Show (); interstitial.Destroy (); } } } }

Viewing all articles
Browse latest Browse all 1416

Trending Articles



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