- Home /
Question by
Gilead7 · Oct 26, 2012 at 07:36 PM ·
c#application.loadlevel
Keeping active variables when switching maps
What is the best way to keep various variables like health, stats, etc when switching between different maps? Thanks!
Comment
Answer by dannyskim · Oct 26, 2012 at 07:42 PM
I tend to use a singleton behaviour for this purpose, in conjunction with DonDestroyOnLoad().
http://wiki.unity3d.com/index.php?title=Singleton
I personally use Berenger's implementation near the bottom of the page.
Your answer
![](https://koobas.hobune.stream/wayback/20220613082927im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Application.LoadLevel(); not working 2 Answers
[C#] How to avoid running any more codes after Application.LoadLevel? 1 Answer
Teleport to next scene on trigger 1 Answer