End/Pause Game!

Can anyone tell me how to either, (or both) pause, or quit the game, with a button: This kind;

if (GUI.Button (Rect (20,40,80,20), "Menu")) {
        Application.LoadLevel (0);

I just need the script and how to use it. Thanks!

Make the button however you want, and put the quit/pause code inside it. For pause, read this:


(A quick Google search would have brought you there)

And for exiting the game to the desktop (doesn't work in the Editor or Webplayer), use this:


qJake’s answer is the right one. But I have another tricky method.
You can freeze the rigidbody.contraints of your player to stop the movement.