- Home /
How can I use my saved playerprefs the next time the game gets started?
You complete level 1-3 but next time you start up the game I want the game to remember this, I already have playerprefs done and checks wether a level is complete etc I just want to know how I can let the game know that it finished all of those levels?
how can I do that?
Thanks.
Answer by Kramboja · Dec 09, 2014 at 12:48 PM
Application.LoadLevel(PlayerPrefs.GetInt("Highest level"))
highest level should return an int. in your build mode you can select the see the level numbers. It's also possible to pick the name but you have to save it in the right player pref. And if you use a name it should be GetString (also SetString)
I don't use this however, I have one scene which depending on level instantiates that level.
Answer by PvTGreg · Dec 09, 2014 at 11:30 AM
Ok so what you could do is at the end of a level use boolprefs found here -http://wiki.unity3d.com/index.php/BoolPrefs and then when you complete a level make levelonecomplete true in boolprefs and in a start function somewhere get the bool
Okay so getting the bools is the information what I need as in when I do playerprefs.save and then in start pull them i can just continue wit hthe bools and ints that I had when i last di playerprefs.save?
yes theese will save where player prefs saves by default so it carry's over when you restart
Answer by screenname_taken · Dec 09, 2014 at 11:39 AM
When you save in player prefs, you could save the name of the level you want to load next, i mean the level that just unlocked. Then have a script read the level saved there and load it.