Quantcast
Channel: Questions in topic: "dontdestroyonload"
Viewing all articles
Browse latest Browse all 416

death count resets after re-loading scene

$
0
0
deahtAds script: public int death; private static readonly Dictionary REVMOB_APP_IDS = new Dictionary () { } }; private RevMob revmob; private RevMobFullscreen fullscreen; // Use this for initialization void Awake () { DontDestroyOnLoad (this); revmob = RevMob.Start(REVMOB_APP_IDS, "Ads"); } void Start(){ #if UNITY_ANDROID RevMobBanner banner = revmob.CreateBanner(RevMob.Position.BOTTOM, 0, 0, Screen.width, 100); banner.Show (); #elif UNITY_IPHONE banner = revmob.CreateBanner(0, 0, 350, 50, null, null); banner.Show(); #endif } // Update is called once per frame void Update () { Debug.Log (death); if (death > 2) { death = 0; revmob.ShowFullscreen(); } } } and in my main character script, when the player dies it supposed to add + 1 to public int death, and when gets to 3 show an ad and reset itself. this is how i add: deathscript.death += 1; in awake function im getting the script deathAds. even tho im using dontdestroyonload, it still does destroy it, and begins the count all over again.

Viewing all articles
Browse latest Browse all 416

Trending Articles



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