- Home /
Set InputField non-interactable without clearing text
I'm making a little interactive terminal, and I want to make the terminal non-interactable until you press "E" on it, then set it non-interactable again after you press escape. However, setting the Interactable property on the Canvas Group seems to erase the text inside an attached InputField. Is there any way to avoid this?
Answer by Flaring-Afro · May 05, 2016 at 12:22 PM
The escape key erases the text when you are typing in the input field. I haven't found a workaround to this, but haven't been messing with input fields lately.
The best thing I can think of off the top of my head is to change the key that you use, or save the text to a variable with every keystroke except for the escape key and then use OnEnable() to set the input field's value to that variable.
Well, to get around this, I turned the press of E to holding E for a second, so I can use E for both actions, and avoid the InputField's auto clearing. Odd behavior, I would that it at least be customizable.
Your answer
Follow this Question
Related Questions
Is it possible to use Windows Form Application to develope user interface in Unity? 1 Answer
PointerEventData pointerID inconsistency 1 Answer
Game shifts to lower right corner post build 0 Answers
Why does clicking on no UI element result in the currently selected selectable being deselected? 0 Answers