Quantcast
Channel: Answers by "dubbreak"
Viewing all articles
Browse latest Browse all 68

Answer by dubbreak

$
0
0
Quickest and easiest way (which will work on any platform) is to save what levels they have passed to [PlayerPrefs][1]. If they need to pass levels consecutively (i.e. pass level 1 before level 2) then you could do something as simple as: //on passing level 5 PlayerPrefs.SetInt("MaxLevelPassed", 5); //========snip - elsewhere in code ======== //on the select level screen int maxLevelPassed = PlayerPrefs.GetInt("MaxLevelPassed") foreach(var levelIcon in levelIcons)//itterate through your level icons or however you select which level { levelIcon.Enabled = (levelIcon.Level <= (maxLevelPassed + 1)) //allow user to play all previously played levels and the next one } Something like this is quick and easy and will get you going. Downside is playerprefs is accessible by the user (if they know unity really well). Otherwise you can save your data to a file (e.g. xml) or database or whatever. Basically you are looking for a way to persist data and playerPrefs is the easiest way. Here's [a video tutorial on using player prefs][2]. There are plenty of people that have asked this question and lots of answers. Here's a good one: [How to script a Save/Load game option][3] [1]: http://docs.unity3d.com/Documentation/ScriptReference/PlayerPrefs.html [2]: http://www.youtube.com/watch?v=Jpi8fRj-wzo [3]: http://answers.unity3d.com/questions/8480/how-to-scrip-a-saveload-game-option.html

Viewing all articles
Browse latest Browse all 68

Trending Articles



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