1
\$\begingroup\$

Unity UI: I have an input field in which I can type. Unfortunately, when I hit any of the movement keys, such as the space bar, I move while I'm typing which is not the effect I want. Is there a way to force the input field to consume the keyboard input so it doesn't also get picked up by the game? Or do I have to write the code in my game to do that for me. (Seems like it should be configurable at least).

\$\endgroup\$
  • \$\begingroup\$ I have the same issue. \$\endgroup\$ – Timothy Schoonover Mar 14 '15 at 2:10
1
\$\begingroup\$

Use a boolean variable to indicate at what point you should enter text and when not, then constrain the actions of his character in relation to the bool, ie:

public bool keyboradisactive;

if(keyboradisactive==false){
    // actions of the character
}else{
}
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.