cancel
Showing results for 
Search instead for 
Did you mean: 

Issues with the Keyboard overlay

Pascal-Teooh
Explorer

We're using the Keyboard overlay with Unity 2020.3.14 / Oculus XR Plugin 1.10.0pre2 / XR Plugin 4.0.7.

 

We have two related issues:

  1. When pressing the keyboard close button (bottom-right) the keyboard just reappears. It seem Unity never gets the focus back as I don't get a InputFocusAcquired event.
  2. The keyboard overlay doesn't seem to handle multiline fields properly. I would expect the tick button to become a return, but pressing this doesn't add a return and instead closes the keyboard, then re-opens it again and because of the previous issue with the close button means you are stuck in the keyboard overlay with no way out...

Both these issues happen with Unity UI InputFields & TMP versions.

 

Thanks,

Pascal.

1 ACCEPTED SOLUTION

Accepted Solutions

Pascal-Teooh
Explorer

Ok, so after a lot more digging, the keyboard close button bug is an issue with Unity's TouchScreenKeyboard implementation. 

 

The status property of this doesn't change when pressing the keyboard close button. You'd expect this to change to Canceled or LostFocus or even Done, but it just doesn't change from Visible.

 

Both the Unity UI & TMP Input field code rely on this property and so explains why they both fail / do nothing in the same way.

 

The Java code for Unity's TouchScreenKeyboard native implementation for Android isn't easily available / readable / replaceable but luckily I had already developed our own replacement for this in our standard Android app. For some reason I thought this wouldn't work on Quest, but the Quest keyboard is actually a standard Input Method Editor so works with my implementation too 🙂

 

To be fair to Unity, detecting the Android keyboard closing is not as simple as it sounds, but after lots of failed attempts, I've got a working solution by polling InputMethodManager.isActive passing in the EditText field as the view.

View solution in original post

15 REPLIES 15

Pascal-Teooh
Explorer

Unfortunately not, I'm not getting a InputFocusAcquired event when the keyboard is closed using the the bottom right button.

 

Anonymous
Not applicable

Are you getting InputFocusLost/Acquired events when you press the Oculus button on the controller? If not, you need to either use the OVRCameraRig provided in the Oculus Integration, or have an instance of OVRManager in the scene.

 

Unity's XR input implementations (LegacyXR or "new" Input System) don't handle input focus gain/loss, and the InputFocus* events are invoked in the Update() method of OVRManager, so they won't work unless there's and enabled instance of OVRManager in the scene.

Pascal-Teooh
Explorer

I am getting InputFocusLost/Acquired events with the Oculus Button and when the user presses the tick button on the overlay keyboard with single line input fields. (I do have an OVRManager instance in the scene)

 

But if the input field is multi-line or the user presses the keyboard close button in the bottom right there isn't an InputFocusAcquired event.

Anonymous
Not applicable

Interesting... 😓

This is literally the first time I've heard of someone using multiline input in VR. This is a puzzler. Wish I could help more.

 

I think you're going to have to dig through the TMP_InputField code. Look for TouchScreenKeyboard.Open (which passes in a multiLine bool) and TouchScreenKeyboard.Status.Done, which I think is where the keyboard has closed and should return focus to Unity.

 

I think you're right that Unity/TextMeshPro is expecting a multiline input keyboard to have a "return" button and to go through a different close procedure, and either Unity or the system keyboard isn't handling that properly.

Pascal-Teooh
Explorer

Yeah, I can have a look at the multi-line thing in the TMP source, for now I've forced to single-line.

 

The bottom-right keyboard close button seems like an Oculus bug though as that doesn't work on single-line fields either.

Anonymous
Not applicable

Just noticed there's an "onTouchScreenKeyboardStatusChanged" event for the TMP_InputField. This should get invoked even when input is cancelled (bottom right button?). Could possibly use this to remove focus from the input field to break out of the keyboard re-summoning loop?

Anonymous
Not applicable

(Also, here's what the multi-line keyboard looks like in the Oculus Browser. No "go" button, "return" instead.)

com.oculus.shellenv-20210723-105721.jpg

Anonymous
Not applicable

Sorry, one more thing (I find this issue pretty interesting). I'm guessing the reason you never get the InputFocusAcquired event is because TextMeshPro runs before OVRManager in the default Script Execution Order.

 

So TMPro resummons the keyboard before OVRManager has a chance to invoke the InputFocusAcquired event?

 

Screenshot 2021-07-23 112646.png