Search Unity

Disable/fix onscreen keyboard on Xbox

Discussion in 'Windows' started by BonneCW, Oct 16, 2020.

  1. BonneCW

    BonneCW

    Joined:
    Jan 22, 2017
    Posts:
    123
    Hi,

    I just noticed that the onscreen keyboard of UWP doesn't work at all on Xbox. When I select an input field it pops up for a frame (or something around that time) and then closes directly again. I can't find a way to reliably open it and keep it open. I have an own onscreen keyboard I use e.g. for controller users on Standalone platforms, but I couldn't find a way to disable the UWP onscreen keyboard so it still pops up and seems to steal focus from my own one (and anyway the popping up is pretty annoying).
    I really need either a fix for this or a way to disable it so I can use my own one.

    I can reproduce it with both 2019.4.12 and 2020.1.9 D3D build.
     
  2. timke

    timke

    Joined:
    Nov 30, 2017
    Posts:
    408
    Hey,

    From your description, it sounds like something is "stealing" input focus away from the Unity text handler causing the Windows InputPane to immediately close.

    For UWP apps (includes Desktop, Xbox, and HoloLens) TouchScreenKeyboard is implemented using WinRT text input APIs. Specifically, CoreTextEditContext for receiving and processing text input and also handling IME and InputPane for displaying the Windows OnScreenKeyboard. These APIs are integrated with the Unity "InputField" and "TextMeshPro" UI controls.

    Could you please elaborate on this and how exactly it works? Does your keyboard implementation also call into WinRT CoreTextEditContext?

    TouchScreenKeyboard is directly tied to Unity's Input Field: a CoreTextEditContext instance is "activated" to process text whenever InputField receives focus, which also calls InpuPane::TryShow() to pop the keyboard. Likewise, when it looses focus, InputPane::Hide() is called to dismiss the keyboard. If your keyboard implementation is also using a CoreTextEditContext instance, it might be conflicting with Unity's instance causing this behavior.
     
  3. BonneCW

    BonneCW

    Joined:
    Jan 22, 2017
    Posts:
    123
    Oh, it's just a canvas and a bunch of buttons, so nothing fancy. But at least it works.
    I could solve the issue for now by disabling the Input Field component in the UWP build and opening my own one when selecting it, but I actually would prefer the native one as that's probably what players are used to.
    I also tested with my own one completely disabled, so the issue has nothing to do with that. In general I don't use anything special there. I found a lot of older posts stating that the keyboard for UWP doesn't work properly, maybe it's just still not fixed?
     
  4. timke

    timke

    Joined:
    Nov 30, 2017
    Posts:
    408
    Thanks for the extra bit of context.

    Will you please file a bug for this issue? This isn't a known issue, and we'll need to investigate. Unfortunately, other than not using InputField, I don't know of any other work-around.

    Over the 2019 release period, the TouchScreenKeyboard for UWP was completely rewritten. This was to properly support IME (since in Windows IME and OnScreenKeyboard are part of the same API set), integrate Keyboard with InputField (before it didn't work at all), and also to address problems on HoloLens. While the keyboard functionality was greatly improved, new bugs were unfortunately introduced.

    We are actively fixing UWP Keyboard bugs, and we'll try to get this one fixed as quickly as possible.
     
  5. timke

    timke

    Joined:
    Nov 30, 2017
    Posts:
    408
    An update on this issue: I debugged TouchScreenKeyboard on Xbox One and repro'ed the issue.

    I found the problem is being caused by (what appears to be) some new UI for Xbox UWP apps. When the InpuPane is opened a "Typing on Xbox One" UI is displayed:

    upload_2020-10-22_9-39-2.png

    I haven't seen this behavior before; the edit box used to be part of the OnScreenKeyboard UI itself and not a separate dialogue box.

    Anyway, the TextEdit control on this UI "steals" input focus away from Unity's InputField which in turn calls InputPande::TryHide() that dismisses the OnScreenKeyboard. This all happens quickly (within a frame or two) so you typically won't see the "Typing on Xbox One" UI.

    We'll definitely need to research this problem further and figure out a fix.
    So, if you haven't already done so, please file a Unity bug to track this issue.
     
  6. dopylo

    dopylo

    Joined:
    Oct 27, 2016
    Posts:
    5
    Hi all,
    Any news about this issue?
    I am facing the same problem.
     
  7. timke

    timke

    Joined:
    Nov 30, 2017
    Posts:
    408
    Hey,

    Yes, I've been working on a fix for this issue along with a slew of other TouchScreenKeyboard fixes for both Xbox One and HoloLens. The tickets covering these bugs are all internal, and so I can't provide you with a public link, but once the fixes land I will backport them to 2019 LTS (this may take some time).

    This particular bug was triggered by a behavior change to the InputPane APIs, which we use to implement TouchScreenKeyboard for UWP.
     
  8. timke

    timke

    Joined:
    Nov 30, 2017
    Posts:
    408
  9. dopylo

    dopylo

    Joined:
    Oct 27, 2016
    Posts:
    5
    Thanks for the update timke!
    Any estimation on how much time it would take?
     
  10. timke

    timke

    Joined:
    Nov 30, 2017
    Posts:
    408
    The fixes must first land into "trunk" (currently for the 2021.1 alpha release) before I can do the backports, and now that QA has signed-off of the PR this should be soon. My hope is to complete the backports (to 2019.4) before the holidays, but no promises.
     
    Last edited: Dec 7, 2020
  11. dopylo

    dopylo

    Joined:
    Oct 27, 2016
    Posts:
    5
    Hi timke,
    I just saw the announcement of the new version 2020.2, does this mean that you could apply the input field fixes on the 2019.4 soon?
    Thanks!
     
  12. timke

    timke

    Joined:
    Nov 30, 2017
    Posts:
    408
    Yes, I'm starting to work on the 2020.2 and 2019.4 backports for this along with other TouchScreenKeyboard fixes.
    Again, I can't say exactly when they'll go out, but I am trying to get it done quickly.
     
  13. dopylo

    dopylo

    Joined:
    Oct 27, 2016
    Posts:
    5
    I perfectly understand, thanks a lot timke!!