Hidden Mobile Input

OK, here’s one thing from the “what’s new in Unity 5”.

"
ANDROID

  • Disabled hidden input keyboard.

"

The thing is that I relied on that feature. Most of the time during the game, keyboard will be opened. Now after this feature is gone, how can I bring it back and why was it dropped in the first place?

It seems broken. Just report it as a bug. It’s really annoying. It wasn’t working earlier when hide mobile input was enabled and now they completely ruined it. :rage:

So, the thing is that according to the Android spec soft keyboards are not required to send KeyEvents when keys are pressed. And if no KeyEvents are issued then there is no way for Unity to know which key was pressed. More and more keyboards are taking advantage of this and only works in conjunction with a text field. This is very bad for game applications but that is the reality. Essentially the only keyboards required to send KeyEvents are hardware keyboards.

If anyone knows of any workarounds or solutions to this problem please let us know.

If you are targeting a finite set of devices which you know support hidden input. What you can do is open the keyboard yourself by calling into java. It’s pretty easy to open a keyboard and if the keyboard is emitting KeyEvents it should work.

The java code for opening and closing a keyboard looks something like this:

InputMethodManager imm = context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0); // open keyboard
imm.toggleSoftInput(0, InputMethodManager.HIDE_IMPLICIT_ONLY); // close keyboard

You can use the AndroidJava* classes to do this from a C# script. One thing though, since this is going to open a window it needs to be called on the UI thread. There is an example how to do that here AndroidJavaRunnable.

2 Likes

Okay. I get it now. But why did Hide Mobile Input worked before? Like you could still type in text to Input Field without the text box, although the delete key event didn’t work and there was no way to select the text.

In the past LatinIME has worked reasonably well but many of the other keyboards did not. Here is some information on the problems related to LatinIME in particular.
http://stackoverflow.com/questions/18581636/android-cannot-capture-backspace-delete-press-in-soft-keyboard/19980975

At some point we will probably revisit this and try to make it work. But ever since we added support for hidden input field, it has been causing more harm than good :frowning:

1 Like

Alright! I’m satisfied with your answer. I am happy with the input text box since there’s at least a way to get the input.
One more question though. Can I change the texture of the input box and the ok button? Or hide the OK button?

We have started working on that but nothing has been released yet. - yes, we are aware the current layout/style looks like @#$.

:stuck_out_tongue:

So just to follow up on this hidden input on Android thing… is Unity still working on improvements or did we punt here?

I see the status on this ticket:

is “wont fix”.

I also see however that Yury mentioned just on Apr 14th that a patch is coming. The patch release that came out on Apr 15th didn’t resolve the issue for us (in 5.0.1p1) so I’m hoping this is still in process. Is that the case? Can we expect something in future patch to add support back for hidden input on Android? Any ETA at all?

It is same problem too

How to fix please ?
P/S : I am using Unity 5.0p3 release for Sam Sung Galaxy Trend Plus with Android 4.3

i got same problem. it was not fixed on unity5 and i’m using lastest version now.

Any news from Unity on this one? Is there a specific ticket for this issue?

The current Android solution is hella ugly!

Thanks

1 Like

Bitter, I’m trying to do a plugin to be able to get the keyboard, but I can’t get the text and behavior. Basically it’s a mess to try to get it to work with a plugin and the current system.

Using this:

  • InputMethodManager imm = context.getSystemService(Context.INPUT_METHOD_SERVICE);
  • imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0); // open keyboard
  • imm.toggleSoftInput(0, InputMethodManager.HIDE_IMPLICIT_ONLY); // close keyboard

Any ideas? I’m not able to get the entered text returned to the screen. I’m trying to create a wrapper around it to replace the standard TouchScreenKeyboard with no luck.

I’m using unity 5.3.1f1 and when check Hide Input Mobile and also add TouchScreenKeyboard.hideInput = true; and mainInputField.shouldHideMobileInput = true; , I still get input like that. Any solution to hide or replace inputfield with custom inputfield?
Note : I’m using UI Canvas InputField.

Did you read this thread? It explains exactly what’s going on and the only current known workaround.

The same problem

Is that fixed in any new version now?

1 Like

Have you found a way to hide it? The same question:(

Have you found a way to hide it? The same question

I’ve made hack to hide it GitHub - mopsicus/unity-keyboard-hack: Hack for hiding mobile input box on Android

1 Like