In Game Pause Menu Keydown Issue

Hi All,

EASY TO ANSWER READ THIS PLEASE!

I've decided to write my own pause menu script when a key is pressed by I'm using the function properly. Currently the my pause menu will be called when any key is pressed, but I want to make it a specific key, like M

Here is my script

// Detects keys pressed and prints their keycode
function OnGUI() {
var e : Event = Event.current;
if (e.isKey) {
Debug.Log("Detected key code: " + e.keyCode);
var MainMenu = GetComponent("MainMenu");
MainMenu.enabled = true;
Time.timeScale = 0;
Screen.lockCursor = false;
}
}

This is bound to be an easy question to answer

// Detects keys pressed and prints their keycode
function OnGUI() {
    var e : Event = Event.current;
    if (e.isKey && e.keyCode == KeyCode.M) {
        Debug.Log("Detected key code: " + e.keyCode);
        var MainMenu = GetComponent("MainMenu");
        MainMenu.enabled = true;
        Time.timeScale = 0;
        Screen.lockCursor = false;
    }
}

Here is the list of the key code aliases: http://unity3d.com/support/documentation/ScriptReference/KeyCode.html