How to temporarily disable arrow keys controlling first-person controller in order to write text in 3D text input box
I've created a 3D text input box to enable a player to walk up to it as a first-person controller and type in several lines of text (after hitting Esc and clicking inside the text input box) that are saved to disk. I've already disabled the alphanumeric movement keys, but the arrow keys keep working, of course, meaning that if a player wishes to go back and correct some text this causes the first-person controller to move, too. Not a very user-friendly way of correcting text. Is there a way I can temporarily unlink the arrow keys from controlling the first-person controller once the player has hit Esc, clicked into the text input box and started entering text such that the text input box works like a sort of entry-level word processor while the player is typing and then once he/she has clicked outside the box the arrow keys work again for first-person controller control?
Answer by binaryuniverse · Jun 26, 2018 at 07:53 PM
if (EventSystem.current.currentSelectedGameObject != null) {
//Input field interactions
} else {
//Check input keys
}