whats a command, so I can have a button enable and disable a Javascript. For example I have a main menu and make the button to toggle it on or off the button would be Esc.
This is how you disable a script:
http://unity3d.com/support/documentation/ScriptReference/Behaviour-enabled.html?from=MonoBehaviour
However, that won’t disable OnGUI.
You can either check for enabled or use some other boolean (such as showMenu):
var showMenu = true;
function OnGUI(){
if (showMenu){
//menu code here
}
}
See below on how to check for key presses:
http://unity3d.com/support/documentation/ScriptReference/Input.GetKeyDown.html
Yes it will.
–Eric
Oops, he’s right. I guess I was thinking Start and Awake.