Search Unity

Question Lack of numeric keyboard support on mobile devices

Discussion in 'UI Toolkit' started by fmabres-fisherpaykel, Jan 27, 2023.

  1. fmabres-fisherpaykel

    fmabres-fisherpaykel

    Joined:
    Nov 9, 2021
    Posts:
    2
    I don't know why it has been decided to make every class internal making things like adding support for numeric only fields quite difficult. Example:

    UnityEngine.UIElements.TouchScreenTextEditorEventHandler:89
    Code (CSharp):
    1. base.editorEngine.keyboardOnScreen = TouchScreenKeyboard.Open(base.textInputField.text, TouchScreenKeyboardType.Default, autocorrection: true, base.editorEngine.multiline, base.textInputField.isPasswordField);
    When the touch keyboard opens on focus, you default TouchScreenKeyboardType.Default to open. IT would be so easy to expose which type of TouchScreenKeyboardType we choose =(.
    Any ideas if this type of behaviour will be supported in the future?
     
  2. FreddyC-Unity

    FreddyC-Unity

    Unity Technologies

    Joined:
    Jun 9, 2021
    Posts:
    36
    Hi @fmabres-fisherpaykel,

    We recently added support to achieve that in Unity 2022.2 and newer. Using the newer versions, you should have access to the keyboardType API or set it through the UI builder.
     
  3. fmabres-fisherpaykel

    fmabres-fisherpaykel

    Joined:
    Nov 9, 2021
    Posts:
    2
    what about LTS support for 2021.3.x?