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!

PlayerPrefs is your best option

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.

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.