Loading A Level Using PlayerPrefs

Okay, I have a menu that has three buttons. Play, Controls, and About. When you click on Play, you come to another menu. There are three buttons on that. Resume, New Game, and Back. Here’s the code:

function OnGUI () {
	if (GUI.Button (Rect (175,75,120,40), "Resume")) {
		Application.LoadLevel (3);
		print (PlayerPrefs.GetInt("Player Level"));
	}

	if (GUI.Button (Rect (175,150,120,40), "New Game")) {
		Application.LoadLevel (4);
		PlayerPrefs.SetInt("Player Level", 1);
	}
	
	if (GUI.Button (Rect (175,225,120,40), "BACK")) {
		Application.LoadLevel (0);
	}
}

Okay, so when I click on new game, I got PlayerPrefs to save the fact that the player was on level 1. However, when I click on Resume, it just returns the number 1. How to I get that to redirect the player to Level1?

(code would be VERY helpful)

How about this:

function OnGUI () { 
   if (GUI.Button (Rect (175,75,120,40), "Resume")) { 
      Application.LoadLevel ( PlayerPrefs.GetInt("Player Level") ); 
      // this assumes the level # you want to load is saved in the PlayerPrefs
      print (PlayerPrefs.GetInt("Player Level")); 
   } 

   if (GUI.Button (Rect (175,150,120,40), "New Game")) { 
      Application.LoadLevel (4); 
      PlayerPrefs.SetInt("Player Level", 1); 
   } 
    
   if (GUI.Button (Rect (175,225,120,40), "BACK")) { 
      Application.LoadLevel (0); 
   } 
}

But also note that PlayerPrefs does not work in the current Unity/iPhone – but is on the list of fixes for a future update…