- Home /
Remove Focus From InputField
My question is fairly simple, how does one remove focus from an InputField in the new UI system? I've been looking around the interwebs for a while now, and cannot seem to find a solution that actually works, even ones that are quite devious.
Answer by Suguma · Feb 14, 2017 at 11:59 AM
Long time late again, but the solution is calling input_field.DeactivateInputField();
Note that this will call all the proper events, like OnSubmit.
@GravitonGames mentioned calling OnDeselect, but this will only invoke the events called when the input field is deselect, but will not actually deselect the input field.
Hope this helps someone :)
Weirdly, it doesn't work when you call .ActivateInputField() before calling .DeactivateInputField(). Use .Select() instead.
Answer by GravitonGames · Mar 28, 2016 at 12:40 AM
Long time late but here it is a simple solution:
using UnityEngine.EventSystems;
...
InputField_Name.OnDeselect (new BaseEventData(EventSystem.current));
Your answer
Follow this Question
Related Questions
IPointerClickHandler error 2 Answers
4.6 - What is InputField's type "AutoCorrect"? 1 Answer
Changing UGUI InputField keyboard appearance on iOS 2 Answers
InputField instance isFocused always return false. 0 Answers
uGUI InputField not writeable 0 Answers