Oculus System Keyboard does not return to app correctly

When I select a TMP Input Field while running my app on Quest 2, the Oculus Keyboard appears as desired. However, when I click the enter button, the keyboard closes and then immediately reopens. If I click outside of the keyboard, the keyboard closes and focus resumes in the app, however the state is not correct because if I click on the TMP input field again, the Oculus Keyboard does not appear,

I was not seeing this issue previously, and I am not sure what change introduced this behavior. I have upgraded the Oculus and XR plugins, as well as updating to Unity 2022.2, none of which fixed the issue. Has anyone else seen this behavior? The existing posts seem to have to do with the keyboard not showing up or an issue with focus while the keyboard is active. My issue is the keyboard does not correctly close and return focus correctly to the app.

I am running Unity 2022.2.16
XR Plugin Management 4.3.3
XR Legacy Input Helpers 2.1.10
Open XR Plugin 1.7.0
Oculus XR Plugin 3.3.0

3 Likes

Hey!

I got the same issue:
Clicking on the TMP input field brings up the keyboard fine but when submitting the keyboard disappears and pops up again and I cant type anything or submit again, I have to click out to close keyboard. If I try to click on the Inputfield again, It doesn’t show up, I have to click again to make the keyboard show up again.

Also tried out old builds, got the same issue, so I’m assuming Oculus v53 update did this.
Also checked the builds on Quest1 which has Oculus v50 and works fine there.

I’ve tried to revert my plugins versions, but didn’t help.

Tried with:
Unity 2020.3.46f1, 2020.3.34f1

XR Plugin Management 4.3.3, 4.2.1
XR Legacy Input Helpers 2.1.7
Open XR Plugin 1.7.0, 1.6.0
Oculus XR Plugin 3.3.0
TMP 3.0.6, 3.2.0-pre.4

Having the same issue!!! I’m not crazy

Having this issue as well on Unity 2021.3.25f1. Updated the Oculus integration to no avail.
In Android Logcat, this error appears when the system keyboard fails:

Chiming in to say we’ve got pretty much the same issues as described above.

Using:
Unity 2021.3.22f1
XR Plugin Management 4.2.1
XR Legacy Input Helpers 2.1.10
Open XR Plugin 1.7.0
Oculus XR Plugin 3.2.3

We are having the same bug on 2021.3.18f1 as described above.

Same issue 2021.3.21f1
Now two months running

PS: If anyone have ifgured out a workaround I’m all ears. I’ll post back if I find one.

This also happens on Unity 2022.3.4.

Here’s my packages:

{
  "dependencies": {
    "com.atteneder.draco": "https://github.com/ReachCloudDevelopers/DracoUnity.git",
    "com.coffee.softmask-for-ugui": "https://github.com/mob-sakai/SoftMaskForUGUI.git",
    "com.cysharp.unitask": "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask",
    "com.siccity.gltfutility": "https://github.com/ReachCloudDevelopers/GLTFUtility.git",
    "com.unity.2d.sprite": "1.0.0",
    "com.unity.ai.navigation": "1.1.4",
    "com.unity.animation.rigging": "1.2.1",
    "com.unity.assetbundlebrowser": "https://github.com/Unity-Technologies/AssetBundles-Browser.git",
    "com.unity.burst": "1.8.7",
    "com.unity.cinemachine": "2.9.7",
    "com.unity.collab-proxy": "2.0.5",
    "com.unity.feature.development": "1.0.1",
    "com.unity.ide.rider": "3.0.24",
    "com.unity.ide.visualstudio": "2.0.18",
    "com.unity.ide.vscode": "1.2.5",
    "com.unity.inputsystem": "1.6.1",
    "com.unity.jobs": "0.70.0-preview.7",
    "com.unity.mathematics": "1.2.6",
    "com.unity.memoryprofiler": "1.0.0",
    "com.unity.mobile.android-logcat": "1.3.2",
    "com.unity.nuget.mono-cecil": "1.11.4",
    "com.unity.nuget.newtonsoft-json": "3.2.1",
    "com.unity.postprocessing": "3.2.2",
    "com.unity.probuilder": "5.1.0",
    "com.unity.render-pipelines.universal": "14.0.8",
    "com.unity.scriptablebuildpipeline": "1.21.5",
    "com.unity.shadergraph": "14.0.8",
    "com.unity.splines": "2.3.0",
    "com.unity.test-framework": "1.1.33",
    "com.unity.textmeshpro": "3.0.6",
    "com.unity.timeline": "1.7.5",
    "com.unity.ugui": "1.0.0",
    "com.unity.vectorgraphics": "2.0.0-preview.21",
    "com.unity.visualscripting": "1.8.0",
    "com.unity.xr.arcore": "5.0.6",
    "com.unity.xr.arfoundation": "5.0.6",
    "com.unity.xr.core-utils": "2.2.1",
    "com.unity.xr.hands": "1.2.1",
    "com.unity.xr.interaction.toolkit": "2.4.0",
    "com.unity.xr.management": "4.3.3",
    "com.unity.xr.mock-hmd": "1.3.1-preview.1",
    "com.unity.xr.oculus": "4.0.0",
    "com.unity.xr.openxr": "1.8.1",
    "jillejr.newtonsoft.json-for-unity.converters": "https://github.com/jilleJr/Newtonsoft.Json-for-Unity.Converters.git#upm",
    "com.unity.modules.ai": "1.0.0",
    "com.unity.modules.androidjni": "1.0.0",
    "com.unity.modules.animation": "1.0.0",
    "com.unity.modules.assetbundle": "1.0.0",
    "com.unity.modules.audio": "1.0.0",
    "com.unity.modules.cloth": "1.0.0",
    "com.unity.modules.director": "1.0.0",
    "com.unity.modules.imageconversion": "1.0.0",
    "com.unity.modules.imgui": "1.0.0",
    "com.unity.modules.jsonserialize": "1.0.0",
    "com.unity.modules.particlesystem": "1.0.0",
    "com.unity.modules.physics": "1.0.0",
    "com.unity.modules.physics2d": "1.0.0",
    "com.unity.modules.screencapture": "1.0.0",
    "com.unity.modules.terrain": "1.0.0",
    "com.unity.modules.terrainphysics": "1.0.0",
    "com.unity.modules.tilemap": "1.0.0",
    "com.unity.modules.ui": "1.0.0",
    "com.unity.modules.uielements": "1.0.0",
    "com.unity.modules.umbra": "1.0.0",
    "com.unity.modules.unityanalytics": "1.0.0",
    "com.unity.modules.unitywebrequest": "1.0.0",
    "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
    "com.unity.modules.unitywebrequestaudio": "1.0.0",
    "com.unity.modules.unitywebrequesttexture": "1.0.0",
    "com.unity.modules.unitywebrequestwww": "1.0.0",
    "com.unity.modules.vehicles": "1.0.0",
    "com.unity.modules.video": "1.0.0",
    "com.unity.modules.vr": "1.0.0",
    "com.unity.modules.wind": "1.0.0",
    "com.unity.modules.xr": "1.0.0"
  },
  "scopedRegistries": [
    {
      "name": "package.openupm.com",
      "url": "https://package.openupm.com",
      "scopes": [
        "com.atteneder"
      ]
    }
  ]
}

Looks like it got patched? At least part of it…

Submit button works as it should, but when I want to close it clicking outside of the keyboard I have to click a few times and after that I have to click the inputfield two times to reopen the keyboard.

I use the same build, nothing changed on my end, whats changed is Oculus OS version is v55

Can someone else confirm this?

Same issue after updating OS from v59 to v60. System keyboard in unstable. It seem Unity never gets the focus back after using keyboard as I don’t get a InputFocusAcquired event.

The issue I’m having, is sometimes the keyboard doesn’t even open.

I only have like two input fields in the whole project. Most of the time, no issues.
Keyboard pops up like it should when clicking in TMP Input field.

But othertimes, I can see the system controller/hands flash visible, but its only for a fraction of a second, and the keyboard doesn’t come up. Any ideas on that?

Hi @mrphilipjoel , I am experiencing the same issue.

I have just created a new project using the VR Core template and added a TMP Input field to one of the UI of the tutorial scene. Sometimes it opens and other times we only see the OS hand controllers flashing. It looks like it depends on how fast/slow you trigger/release when you click on the UI.

I am using Unity 2022.3.20f1, XR Interaction Toolkit 2.5.2, Oculus XR Plugin 4.1.2, Oculus OS v65

Finally I have created this script which opens itself the keyboard and retrieves the text value. It simply needs to be attached to the TMP Input field.

using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;


[RequireComponent(typeof(TMP_InputField))]
public class ImprovedTouchScreenKeyboard : MonoBehaviour, IPointerClickHandler {

    TMP_InputField _inputField;
    TouchScreenKeyboard _keyboard;

    // events to disable/enable virtual controler representations
    public UnityEvent onKeyboardOpen;
    public UnityEvent onKeyboardClose;


    void Start() {
        _inputField = GetComponent<TMP_InputField>();
        _inputField.shouldHideSoftKeyboard = true;
    }

    public void OnPointerClick(PointerEventData eventData) {
        if (_keyboard != null) {
            return;
        }

        TouchScreenKeyboardType keyboardType = TouchScreenKeyboardType.Default;
        bool secure = false;
        bool autocorected = false; // not working on my quest

        switch(_inputField.contentType) { // trying to match TMP_InputField.ContentType and TouchScreenKeyboardType, but not everything is working
            case TMP_InputField.ContentType.Pin:
            case TMP_InputField.ContentType.IntegerNumber:
                keyboardType = TouchScreenKeyboardType.PhonePad;
            break;
            case TMP_InputField.ContentType.DecimalNumber:
                keyboardType = TouchScreenKeyboardType.NumberPad;
            break;
            case TMP_InputField.ContentType.EmailAddress:
                keyboardType = TouchScreenKeyboardType.EmailAddress;
            break;
            case TMP_InputField.ContentType.Name:
                keyboardType = TouchScreenKeyboardType.NamePhonePad;
            break;
            case TMP_InputField.ContentType.Autocorrected:
                autocorected = true;
            break;
            case TMP_InputField.ContentType.Password:
                secure = true;
            break;
        }

        string placeholder = null;
        if(_inputField.placeholder) {
            var text = _inputField.placeholder as TextMeshProUGUI;
            if (text != null) {
                placeholder = text.text;
            }
        }

        _keyboard = TouchScreenKeyboard.Open(_inputField.text, keyboardType, autocorected, _inputField.multiLine, secure, false, placeholder);

        onKeyboardOpen.Invoke();
    }

    void LateUpdate() {
        if (_keyboard == null) {
            return;
        }

        _inputField.text = _keyboard.text;
        _inputField.selectionStringAnchorPosition = _keyboard.selection.start;
        _inputField.selectionFocusPosition = _keyboard.selection.end;

        if(_keyboard.status != TouchScreenKeyboard.Status.Visible) {
            _inputField.onEndEdit.Invoke(_inputField.text);
            _keyboard = null;
            onKeyboardClose.Invoke();
        }
    }
}
1 Like

Hi @colin-defais

We have facing one issue in Oculus system keyboard that keyboard is open using this method , but i can interact with the keys in the keyboard but those not updating in my input field. Please let me know to how to fix this issue or any one have face similar issue.

Keyboard open Function:

public void KeyboardInvoke(TMP_InputField field)
{ currentFocusedInput = field;
keyboard = TouchScreenKeyboard.Open(ā€œā€,TouchScreenKeyboardType.Default);
}

//This function is assigned to inputfield onvalue changed event :

public void KeyboardValueChanged()
{ if(!currentFocusedInput)
return;
currentFocusedInput.text = keyboard.text;
}

KeyboardValueChanged function is does not call sometime but keyboard is opened what is the problem with this this is the oculus bug or need to change the flow.
Note : We have multiple inputfield the above script is suitable for toggle the active inputfield.

Just use this instead of TMP_InputField

public class TMPInputFieldVR : TMP_InputField
{
    public override void OnPointerDown(PointerEventData eventData)
    {
        // Do nothing because it doesn't need for VR
    }

    public override void OnPointerClick(PointerEventData eventData)
    {
        // Call On Select when OnPointerClick fired instead of OnPointerDown
        OnSelect(eventData);
    }
}

more info you can read here Solved: Re: System keyboard not opening every time in Meta... - Page 2 - Meta Community Forums - 1179306

Im using Unity 2022.3.50
XRI 3.0.3
Meta keyboard doesnt disable the input field when dismissed only if the tmp is set to single line.
If it is set to multiline then after dismissing keyboard, the input field is hijacked or disabled. I have to click on a diff inputfield or resize the canvas or click anywhere else other than the input field to click on the same inputfield.

Dont know how to fix this yet.
I tried using the tmp’s OnEdit, OnDeselect, OnValueChanged fields , attached a script that resizes the canvas by 10f when i dismiss the keyboard but it resizes it only after i click anywhere other than the input field.

Its frustrating.