Search Unity

[New Feature Request?] New InputSystem Keyboard KeyUp on iOS 13+

Discussion in 'Input System' started by Ascanio1980, Mar 1, 2021.

  1. Ascanio1980

    Ascanio1980

    Joined:
    Jun 7, 2019
    Posts:
    51
    Hello there!

    Abstract: Unity could use Keyboard KeyDown and KeyUp events for iOS 13+, instead of Keyboard Shortcuts!

    Unity's new Input System listens to keystrokes on iOS by using Keyboard Shortcuts. This is an extremely limited implementation that suffers from a lack of proper KeyUp events: from what I understand they need to be timed out.

    This means that repeated key strokes will be "debounced" (when happening within about half a second).

    There is a way to listen to each key stroke and that is by using:
    keyboard.onTextInput += new Action<char>(MyCallBackFunction);

    -- but -- this also doesn't work completely... arrow keys will trigger a long series of events, for each character in the phrase "UIInputKeyUp".... instead of a single char code for the arrow key.

    Now, by looking at the following web page, it seems that a new, much better implementation could be integrated:
    https://www.swiftbysundell.com/tips/handling-keyup-and-keydown-events/
     
    AcidArrow likes this.
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,792
    At the current rate of one non preview release per year for the input package, I think there is a good chance your feature request will be implemented sometime in the next decade. Look forward to it.
     
  3. glangor

    glangor

    Joined:
    Mar 24, 2013
    Posts:
    15
    Yep, I'm suffering from this now, all I want to do is have the user type letters in iOS and have them come up. Not a complex task you'd think. The new input system doesn't detect the keystrokes at all. The legacy one does, but fails to detect a repeated press of one key within half a second of the last. Anyone who types with more than one finger does it quicker than that, so the keypress is dropped, it's very frustrating.

    Would there be a way to edit the code in the generated xcode project to use this? The file:

    Build Folder\Classes\UI\UnityView+Keyboard.mm

    is the one that does the timeout/debouncing, but I'm no Objective-C++ person. Anyone know how we'd do it?
     
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,792
    The rate of releases has increased since my post last year, so my new prediction is that you might have to wait only 3 more years until a basic feature is implemented.