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

Don't lose variable data when reloading a level - c#

$
0
0
Hi, In my game when I used Respawn() I want it to obviously respawn the player, however I want it to save the amount of lives and score the player has when the level is reloaded. When the player does die it reloads the level but the live remain on 3. public int lives = 3; void Respawn() { lives -= 1; DontDestroyOnLoad (gameObject); Livestext (); //ignore Application.LoadLevel(Application.loadedLevel); } As you can see I tried DontDestroyOnLoad but I still had the same results... Thanks in advance.

Viewing all articles
Browse latest Browse all 416

Trending Articles



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