- Home /
Getting reference to TouchScreenKeyboard on mobile devices
Unity automatically pulls up TouchScreenKeyboard when you tap on something in the UI like an InputField. This is great.
However, I can't see anyway to actually get a reference to it. Why do I want a reference? So I can detect when TouchScreenKeyboard.done is true. This leaves me with two options, I'd take a solution on either one:
Get a reference to Unity's automatically pulled up TouchScreenKeyboard. Hence the question, if you know how, please let me know!
Disable Unity from automatically pulling up the TouchScreenKeyboard on certain UI events. That way I can pull it up manually, and obviously grab my own reference.
Any help?
Answer by Geometrical · Dec 23, 2016 at 12:39 AM
You can hide the keyboard under specified conditions: Click here to find out how also here
Yah oops didn't post as a comment, my bad. This won't work because as you'll note in their example, they already have a reference to the keyboard, it's not the automatic keyboard brought up by Unity. That example assumes you're hiding a keyboard you've already got a reference to, which is not the case when Unity automatically pops it up for you!
As to the reply that "just create a custom keyboard for text input, he'll have plenty of control over that :)" this also doesn't address the problem because the Unity keyboard automatically pops up, that's why I have option 2 above. For that to work though, I'd have to suppress the Unity automatic keyboard which I don't know how to do (hence option 2 question above).
So yah, that doesn't really answer the problem unfortunately. I'd already read through those docs. The problem remains as outlined in options 1 and 2 above.
Anyone else have any insight or ideas?
Answer by ramishaziev · Dec 21, 2018 at 07:00 AM
InputField has touchScreenKeyboard property, you can use it