Need alternative for onEndEdit on InputField
onEndEdit is triggered when the user has ended editing the text by pressing submit or clicking outside the InputField. I have a chat functionality in my game and I don't want the message the user typed to be send when the user clicks outside of the InputField, only when they press submit. What can I use? I know there is an TouchScreenKeyboard.done event that I think I could use, but I don't know how to reach the keyboard that is opened by InputField.
Answer by fschneider · Sep 28, 2016 at 04:57 PM
Did you solve your problem? I'm having a similar issue, and worked around the fact that InputField does not expose its touch keyboard by subclassing InputField.
However when using this on Android, TouchScreenKeyboard.done is true when the done / return button is pressed AND when the user touches outside the input field, so I could not differentiate between the two events.
Answer by G-Reusch · Nov 18, 2016 at 11:26 PM
This answer is a bit late, but could you potentially set up a Submit function that only runs when the user presses the "enter" key (or whatever button you'd like to use)? You could have a bool that is set to true whenever the value of the input field is changed, and set to false whenever onEndEdit is called. That way, it would only send the message when the user is typing and presses your submit key, and not onEndEdit or when the user isn't typing anything.