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

C# Advertisment every so many plays

$
0
0
Hey guys, I'm trying to play an ad every so many new games. (My game is a play/die/retry type game). My thinking is that I can establish an incremental adding integer like this: void Start () { numOfGames = PlayerPrefs.GetInt ("newGames"); add1 = numOfGames += 1; PlayerPrefs.SetInt ("newGames", add1); PlayerPrefs.Save (); } in another script I call the ads based on if the number of new games is a multiple of 4 like this: using UnityEngine; using System.Collections; using UnityEngine.Advertisements; public class adsAtAnInterval : MonoBehaviour { [SerializeField] string gameID = "00MYID00"; public int gameSessionInt; public int modulo; void Awake(){ Advertisement.Initialize (gameID, true); } // Use this for initialization void Start () { gameSessionInt = PlayerPrefs.GetInt ("newGames"); modulo = gameSessionInt % 4; advertAtInterval (); } void advertAtInterval(){ if (modulo == 0 && Advertisement.IsReady()) { Advertisement.Show("rewardedVideo"); } } } Regardless if modulo == 0, my ads are not showing. Anyone have any thoughts? Much appreciated! -A

Viewing all articles
Browse latest Browse all 1416

Trending Articles



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