How can I save level progression
Ok, so I use this code
public static readonly int NUMBER_OF_LEVELS = 12;
public static bool[] finishedLevels = new bool[NUMBER_OF_LEVELS];
And I need to save this bool because the level selection menu checks if the bool equals true( at the end of each level it makes that level's number equal true) So how would i go abouts using player prefs to save the data.
PlayerPrefs.SetInt("boolName", boolValue ? 1 : 0);
however, if the levels are only completed in order, then why not just store the last level number the player has completed?
Thanks, but I built the system before and dont wanna re make it
I also want the player to be able to return to previous levels
Answer by Redwolve · Apr 12, 2016 at 02:50 AM
So a way I use to store data and make it accessible to everything in my scene (and what I use as a carryover between scenes) is an empty Animator. You can assign it to a main GameObject and assign all the variables you want (well as long as they are numeric or bool) and reference that from anywhere just by throwing it in the script and linking with the Inspector. And then all you do is use GetBool and SetBool and you should have all that you need.
I hope this helps, I look at things a bit different that others but hey that's why I like programming. Please let me know if it helps you!
Your answer
Follow this Question
Related Questions
Having a bit of a problem with loading a save file. 0 Answers
How to save player score? (C#) 0 Answers
Save and load whole scene 2 Answers