Is there anything I can add to the standard mouse look script to allow me to pause the mouse look function during the game by pressing a single button either once or twice?
There’s a few different approaches you can take to pausing a game. Some of them are more general and/or involved and are geared towards pausing everything in the simulation, more or less; you’d use these techniques for (for example) pausing the game when an in-game menu is brought up.
If all you want to do is pause the mouse look behavior though, you can just add the appropriate code directly to the ‘mouse look’ script. Add a boolean ‘paused’ variable, and toggle it in response to the appropriate key events. Then, associate the code that processes user input with the conditional ‘if (!paused)’, so that it will only execute when ‘paused’ is false.
You can use the enabled property.
http://unity3d.com/support/documentation/ScriptReference/Behaviour-enabled.html?from=MonoBehaviour
Another thing you could do, if you want to actually pause the game, is set Time.timeScale to zero, which will totally stop most scripts, as they all use Time.deltaTime somewhere, and even then, many Unity functions also use it, so it will pause most things.
What would this code look like? I’m sorry I am a scripting newbie
public var isPaused : boolean = false;
function Update ()
{
if (!isPaused)
{
// do stuff
}
if (Input.GetKeyDown ("p"))
isPaused = !isPaused;
}