I use an editor script placed in editor folder, which listens to a key pressed.
When the key is pressed, it is supposed to trigger a function from MonoBehavior script. The issue is that the function does not get triggered at all. I am even adding EventSystem in my inspector. What is the problem here? :
[CustomEditor (typeof (Switcher))]
public class SiwtcherEditor : Editor {
void OnSceneGUI () {
Switcher script = (Switcher) target;
Event e = Event.current;
switch (e.type) {
case EventType.KeyDown:
{
if (Event.current.keyCode == (KeyCode.A)) {
Debug.Log ("A pressed");
script.SwitchHere();
e.Use ();
}
break;
}
}
}
}
public class Switcher : MonoBehaviour {
public void SwitchHere () {
Debug.Log ("GotINPUT");
}
}