- Home /
Load last checkpoint from main menu
Hi everyone. I want a simple main menu where the player can press on "Resume Game" and it will take him to the last checkpoint he went through. And I also want it to work when the player exits the game and play it later. I googled everything but I couldnt find anything useful. If you guys can help me I'd really appreciate it.
PS. I'm working with javascript.
Thanks everyone, Have a great day!
Answer by gjf · Jul 29, 2014 at 11:14 AM
`PlayerPrefs` is your best option
Thanks.. but but the problem is that I dont know how to use that and I thought someone could explain me or show me here.
Answer by Miziziziz · Jul 29, 2014 at 10:08 PM
find a way to save your game first, there's plenty of solutions for that in Unity lying around on the forums(e.g. http://forum.unity3d.com/threads/unity-save-game-level-serialization.138678/). Once you do that, have an autosave function that occurs when the player exits. Resume game simply loads that save.
Answer by NoTakeful · Jul 30, 2014 at 10:47 AM
if you want to have a checkpoint system, and none of these answers have worked for you, you could try setting a PlayerPref to a number when they hit the checkpoint you desire. Before you do this though, you probably need to find a way to be able to save the game. but I can show you how player prefs works a little bit. You can store strings, floats, and integers. Simply put:
PlayerPrefs.SetInt("Checkpoint1", 1);
then when they push the resume button put:
if(PlayerPrefs.GetInt("Checkpoint1") == 1){
}
then load a save or something.
Your answer
Follow this Question
Related Questions
load button in main menu 1 Answer
Remembering the state of a scene 1 Answer
Serializer.Resume() not working for multiple levels 0 Answers
Save and Load from XML help 1 Answer
Drag and Drop menu and Save load game. 0 Answers