- Home /
Input in editor scripts
Is it possible to detect user input in an editor script? The Input class isn't working at all. Input.GetKey never returns true, and Input.mousePosition is always zero.
The only thing I have seen that adds a hotkey is when you create a menu item. // Add menu named "Do Something" to the main menu // and give it a shortcut (ctrl-o on Windows, cmd-o on OS X). @$$anonymous$$enuItem ("GameObject/Do Something %o") static function DoSomething () { Debug.Log ("Perform operation"); } alexnode 0 secs ago
Answer by col000r · Jul 03, 2012 at 08:01 AM
Input does not work, but you can use Event.current.alt, Event.current.control, etc to see if alt or ctrl or any of the modifier keys are pressed.
And you can use Event.current.button to determine which mouse button is pressed!
Answer by AngryAnt · May 21, 2010 at 12:34 PM
It is not. The Input class is only running in playmode and runtime. For editor scripting you are limited to what GUI events offer you - meaning you would need your handler to live in either a custom inspector or an editor window.