This basic example shows how you can use GUIButtons to allow the user to Save and Load the state of the game. When the user presses 'Quit', it saves whichever variables we need to save. When they press 'Continue', it loads these variables.
public void OnGUI() { // Quit button. When clicked, we'll save our data. if (GUI.Button(new Rect(10, 60, 50, 50), "Quit")) { // Save whatever needs to be kept the same. // Must be in the Supported Types list. ES2.Save(myInt, "myInt.txt"); ES2.Save(myString, "myString.txt"); } // Continue Button. When clicked, we'll load our data. if (GUI.Button(new Rect(10, 10, 50, 50), "Continue")) { // If there is data to load, load it. if(ES2.Exists("myInt.txt")) { // Load what we saved before, and reassign it // to our variables. myInt = ES2.Load<int>("myInt.txt"); myString ES2.Load<string>("myString.txt"); } } }