- Home /
Question by
DivineRage · Oct 17, 2014 at 09:19 PM ·
guiinputtextfield
Get key state while textfield has focus?
Whenever a TextField has keyboard focus, any Input.GetKey(Down/Up) calls seem to return false.
private void Update() {
if (Input.GetKey(KeyCode.LeftControl)) Debug.Log("True");
}
private void OnGUI() {
GUILayout.Label(Input.GetKey(KeyCode.LeftControl).ToString());
GUILayout.TextField("");
}
Is there any way to simply get any key state either in Update
or OnGUI
? I am aware of the option to use Event.current.keyCode
, but I'd prefer to stay away from keeping track of all key presses.
Comment
Your answer
Follow this Question
Related Questions
Input not registering while TextField is selected 3 Answers
TextField, Event.current, Input.GetKey, and GUI.FocusControl locking 1 Answer
Backspace in limited length textfield causes ArgumentOutOfRangeException 1 Answer
Android Textfield locks out input until esc 2 Answers
Text.Field erratically updating 0 Answers