Hi I have a problem with the input field and the android keyboard.
I have in a scene two elements:
An Input field.
A button to continue to the next scene.
When I press on the input field the keyboard of my phone opens, if I press outside the keyboard for example on the continue button, the first click causes the keyboard to close and the second click is the one that executes the action of the button. How can I have the keyboard open and in the first click close the keyboard and also press the continue button? This only happens on Android.
Sadly, this is the current limitation of the keyboard and this is a very old problem. Currently it’s impossible to achieve what you’ve described.
There are changes incoming which will fix this, it should appear in 2022.1 and if everything’s good it will be backported to previous Unity versions as well, but it might take 2-3 months for things to settle down.
@Tomas1856 I just tried it, and when setting closeKeyboardOnOutsideTap to false, tapping outside of the keyboard still hides it on 2020.3.26f1.
What happens is that the first tap that closes the keyboard also registers with the underlying UI (which is what OP wants), but the name of the property implies that setting it to false results in the keyboard to stay on screen instead of disappearing.
Well not sure if this will help or be a good solution but for IOS I ended up with an easier solution. Open Keyboard class from Xcode under Classes-UI. Search for “- (void)textInputLostFocus” function. Comment the codes inside this function. Thats all! Now whenever your inputfield loses its focus keyboard will remain visible. It will not close when you tap outside keyboard. You can close keyboard by tapping done or cancel button on top of keyboard.