Is there a way to manually close the keyboard on a mobile device (iPad)?

Is there a way to close the keyboard that pops up when you select a text field on iPad? I tried googling, but all the results seem to be about the old ui system.

For anyone wondering, at least for the text field element, it is possible to use

myTextField.touchScreenKeyboard.active = false;

to turn off the keyboard that automatically pops up when you focus in on a text field. I had to do this because I was having an issue where, after focusing in on the text field (and the keyboard automatically popping up), clicking on certain other elements, like a button, would cause a focus out event on the text field, as expected, but would NOT close the keyboard.

Don’t know if this happened because of something I did or if this is a Unity bug, but either way this seems to solve the issue.

There is more info about TouchScreenKeyboard here: Unity - Scripting API: TouchScreenKeyboard

1 Like