LockCursor Changing The Pause Button

I'm creating an FPS, and I'm using the LockCursor script that's in the FPS Tutorial script. I have been scripting for quite some time, but when I examine the code, I don't see where the "Escape Button Input" is called. Can someone help me, I would like to change the button that pauses the game.

    function Start ()
{
    // Start out in paused mode in web player

    if (Application.platform == RuntimePlatform.OSXWebPlayer ||
        Application.platform == RuntimePlatform.WindowsWebPlayer)
    {
        SetPause(true);
    }
    else
    {
        SetPause(false);
        Screen.lockCursor = true;
    }
}

function OnApplicationQuit ()
{
    Time.timeScale = 1;
}

function SetPause (pause : boolean)
{
    Input.ResetInputAxes();
    var gos : Object[] = FindObjectsOfType(GameObject);
    for (var go : GameObject in gos)
        go.SendMessage("DidPause", pause, SendMessageOptions.DontRequireReceiver);

    transform.position = Vector3.zero;

    if (pause)
    {
        Time.timeScale = 0;
        transform.position = Vector3 (.5, .5, 0);
        guiText.anchor = TextAnchor.MiddleCenter;
    }
    else
    {
        guiText.anchor = TextAnchor.UpperLeft;
        transform.position = Vector3(0, 1, 0);
        Time.timeScale = 1;
    }
}

function DidPause (pause : boolean)
{
    if (pause)
    {
        // Show the button again
        guiText.enabled = true;
        guiText.text = "Click to start playing";
    }
    else
    {
        // Disable the button
        guiText.enabled = true;
        guiText.text = "Press Escape To Show Menu";
    }
}

function OnMouseDown ()
{
    // Lock the cursor
    Screen.lockCursor = true;
}

private var wasLocked = false;

function Update ()
{
    if (Input.GetMouseButton(0))
        Screen.lockCursor = true;

    // Did we lose cursor locking?
    // eg. because the user pressed escape
    // or because he switched to another application
    // or because some script set Screen.lockCursor = false;
    if (!Screen.lockCursor && wasLocked)
    {
        wasLocked = false;
        SetPause(true);
    }
    // Did we gain cursor locking?
    else if (Screen.lockCursor && !wasLocked)
    {
        wasLocked = true;
        SetPause(false);
    }
}

You don't change it in that script (since it has no reference of an "Escape" button anywhere), you change it in the Input Manager (Edit > Project Settings > Input). Look for an input that controls button "escape".

If you're sure that the Input Manager doesn't hold a control for the "escape" key, then the game may be banking on some other functionality, perhaps when you press Escape in the web player to make it lose focus, I'm not sure. It's hard to tell without seeing more of the project.

Alternatively, if you want to ADD a key that pauses the game (but not remove escape), you can simply do something like this:

if(Input.GetKeyDown(KeyCode.P))
{
    SetPause(true);
}

You can change that to anything you want, and you can even use a string, like `GetKeyDown("T")` or something like that. From what you posted, that should pause the game.

You aren't going to be able to in the web player, really. The escape button is hard coded to always unlock the cursor. Which is why the line `if (!Screen.lockCursor && wasLocked)` is returning true and causing the game to pause..

When u press Esc the wasLocked will be true because when u press esc it enables ur cursor and the script knows that when the cursor is locked the wasLocked variable is still true,so if it's true and ur Screen.lockCursor is false,it'll make it wasLocked = false, and then It'll Pause it with SetPause(true); . then u can change it in the Edit -> Project Settings -> Inpu,t the "esc" button because it's the default button that makes the cursor set to false.

function Update ()
{
    if (Input.GetMouseButton(0))
        Screen.lockCursor = true;

    // Did we lose cursor locking?
    // eg. because the user pressed escape
    // or because he switched to another application
    // or because some script set Screen.lockCursor = false;
    if (!Screen.lockCursor && wasLocked)
    {
        wasLocked = false;
        SetPause(true);
    }