Search Unity

Keyboard input WebGL Mobile

Discussion in 'Web' started by tmorelli, Nov 19, 2017.

  1. xaldin-76

    xaldin-76

    Joined:
    Oct 1, 2016
    Posts:
    25
    I have tried 2022 a13, tmp input field, webgl upload to simmer io, sadly keyboard did not show up (android 10, samsung j6).
    But yeah release notes says it should be working in a13
     
  2. kerfiz

    kerfiz

    Joined:
    Jun 8, 2021
    Posts:
    1
    Work in a13, but only in Legacy Input Fields (not TMP). It create additional HTML field for input. This is not thing I was waiting for...
     
  3. brendanduncan_u3d

    brendanduncan_u3d

    Unity Technologies

    Joined:
    Jul 30, 2019
    Posts:
    437
    One note about the keyboard: the TextMeshPro Input Field needs an update in the TMP package for the keyboard to work with those fields, which is still coming.
     
    Nerzal likes this.
  4. brendanduncan_u3d

    brendanduncan_u3d

    Unity Technologies

    Joined:
    Jul 30, 2019
    Posts:
    437
    The creation of the additional HTML field for input is necessary for web browsers. There is no way around that.
    There will also be some styling cleanup coming, as iOS15 changed some behavior between beta and release.
     
    Nerzal likes this.
  5. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    Hello,

    Can we get this feature backported to 2021.2 (or 2021.3)? I attempted to use 2022 for my project but it's unstable right now. What exactly did you turn on to allow this feature? Is it just creating a text field in Html and using that?

    Thanks,
    crafTDev
     
    xucian likes this.
  6. Unitiblis

    Unitiblis

    Joined:
    Aug 7, 2018
    Posts:
    13
    Looking forward to this feature! Will this also work for InputFields created with UI Toolkit?
     
  7. Nerzal

    Nerzal

    Joined:
    Aug 5, 2015
    Posts:
    5
    Hi, first of all - thanks for your work on that topic!
    Im really excited to see this coming.

    Do you maybe already have a rough estimation, when we can test the updated TMP package?

    I'm currently using "dirty" workarrounds, which..well lets say they do their job, but i'm not really happy with my solution :D

    It looks like it is not yet in the TMP 4.2 preview.
    https://docs.unity3d.com/Packages/c...hangelog/CHANGELOG.html#400-pre1---2021-10-27

    I'll happily give feedback as soon as this lands in any preview/alpha/beta whatever versions :)

    Update 2: The legacy input works like a charm! Now i'm rooting for the TMP one <3
     
    Last edited: Nov 13, 2021
  8. tevekidis

    tevekidis

    Joined:
    Sep 26, 2019
    Posts:
    1
    Hey. in what version of unity you build that with sucess. its keep saying me cannot read properties of null when i have the overlay input. and in the popup one sometimes i press ok and it doesnt go. it just opens the popup again. do anyone have a workaround. i am desperatly working days on it.

    Edit:it gives me this error on the console
    Uncaught TypeError: Cannot read properties of null (reading 'style')
    at HTMLInputElement.onclick
     
    Last edited: Nov 14, 2021
  9. brendanduncan_u3d

    brendanduncan_u3d

    Unity Technologies

    Joined:
    Jul 30, 2019
    Posts:
    437
    @Nerzal I have the TMP PR that I've been pestering that team to pull in. It's a bit out of my control when they do, but I'll keep pestering them.

    @crafTDev Unfortunately, no, there was quite a bit of integration into Unity's soft keyboard system. The HTML input is just the mechanism to have the browser bring up the keyboard. They don't let us backport that level of change.

    @Unitiblis Yes, it should work with UI Toolkit input fields.
     
    Nerzal likes this.
  10. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734
  11. KamilCSPS

    KamilCSPS

    Joined:
    May 21, 2020
    Posts:
    448
  12. tantx

    tantx

    Joined:
    Jul 5, 2017
    Posts:
    23
    I also waiting for this feature
    Hope everything could be ok
     
  13. jasonkappes656

    jasonkappes656

    Joined:
    Aug 8, 2021
    Posts:
    5
    I can confirm that the 3rd party package https://github.com/kou-yeung/WebGLInput is working for IOS.

    WebGL mobile input works for IOS 14.8.1 with an iPhone 8 input on Safari 15.0. This works using the "WebGL Input" (not "WebGL Input Mobile") component from the package attached to the InputField.
     
  14. Nerzal

    Nerzal

    Joined:
    Aug 5, 2015
    Posts:
    5
    brendanduncan_u3d likes this.
  15. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    Hello,

    Does this work for TMP in 2022 yet?

    Thanks,
    crafTDev
     
  16. Thaina

    Thaina

    Joined:
    Jul 13, 2012
    Posts:
    1,166
    It seem this still was not possible in 2022. TMPro is still not updated or even have experimental preview available
     
  17. brendanduncan_u3d

    brendanduncan_u3d

    Unity Technologies

    Joined:
    Jul 30, 2019
    Posts:
    437
    The update was put into TMP, but I haven't followed what their release schedule is. I thought it would have been released by now, but I guess not. I'll look into what's going on with that.
     
    Thaina likes this.
  18. brendanduncan_u3d

    brendanduncan_u3d

    Unity Technologies

    Joined:
    Jul 30, 2019
    Posts:
    437
    The WebGL support is in the TMP 3.2.0 branch, which is currently in release candidate.
     
  19. Thaina

    Thaina

    Joined:
    Jul 13, 2012
    Posts:
    1,166
    Thank you very much but I don't see it in package manager even I have enable preview package. Have I need to do something for it to show up?

    upload_2022-2-13_19-20-33.png
     
  20. Thaina

    Thaina

    Joined:
    Jul 13, 2012
    Posts:
    1,166
    Using "com.unity.textmeshpro": "3.2.0-pre.2" or even 4.0 in 2022.1.0b7 still could not conjure virtual keyboard for TMPro. Not only that, when I try to use external keyboard, it cannot focus on the input field I touched, it randomly focus on other input field in the canvas

    This behaviour only appeared in mobile and not in PC version

    Also the copy/paste is not actually work. It can only copy/paste in the unity itself but not really able to paste from outside clipboard

    Do we have any url for working sample I could see for TMPro webgl?
     
    Last edited: Feb 14, 2022
  21. De-Panther

    De-Panther

    Joined:
    Dec 27, 2009
    Posts:
    589
    Tested the keyboard for simple needs and it worked great!

    We do have some extra needs from time to time, and we already have a custom keyboard that we use for those.

    Is there a way to edit or disable the keyboard, so we'll be able to use a custom one?

    Thanks.

    @brendanduncan_u3d
     
  22. brendanduncan_u3d

    brendanduncan_u3d

    Unity Technologies

    Joined:
    Jul 30, 2019
    Posts:
    437
    @De-Panther Yes, you can disable it using
    WebGLInput.mobileKeyboardSupport = false;

    .
     
    De-Panther likes this.
  23. ajeempasha

    ajeempasha

    Joined:
    Dec 7, 2017
    Posts:
    2
  24. parixit2411

    parixit2411

    Joined:
    Nov 10, 2021
    Posts:
    12
    Is keyboard input working with TMP now? Which version of the TMP package?
     
    mimiCryMuffin likes this.
  25. ajeempasha

    ajeempasha

    Joined:
    Dec 7, 2017
    Posts:
    2
    No, not working yet.
     
    mimiCryMuffin likes this.
  26. TheTimeSte

    TheTimeSte

    Joined:
    Apr 4, 2021
    Posts:
    5
  27. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    This works finally!

    Thanks, guys!
    crafTDev
     
    Thaina likes this.
  28. Damast

    Damast

    Joined:
    Apr 25, 2019
    Posts:
    13
    Also, the Font is really blurred at the Bottom but I think that's the tmp pre-release...
     
  29. greatergoodguy

    greatergoodguy

    Joined:
    Jan 10, 2013
    Posts:
    7
    I have the same issue as Thaina. How do you get TMP 3.2.0? When I look in Package Manager, it says the latest version is 3.0.6.
     

    Attached Files:

  30. joxthebest314

    joxthebest314

    Joined:
    Mar 31, 2020
    Posts:
    95
    Enable pre-release in the settings. After that, add it by name (the + button). The name is the url : com.unity.textmeshpro and version is 3.2.0-pre.3 or anything else you want.
     
    Lughinu likes this.
  31. AcePoker

    AcePoker

    Joined:
    Jul 12, 2022
    Posts:
    1
    Hi Brendan, I was wondering if it is possible for user to override the method call to
    Code (JavaScript):
    1. function _JS_MobileKeyboard_Show(text, keyboardType, autocorrection, multiline, secure, alert, placeholder, characterLimit)
    from the cs input class that calls it. This might allow us to customize the position of the html text box to the intended location instead of always remaining on the bottom.
     
  32. Fillmore

    Fillmore

    Joined:
    Feb 14, 2018
    Posts:
    11
    For anyone wondering, this has NOT been added (or working) in 2021.3.6
    TouchScreenKeyboard.Open does nothing when used in WebGL.


    Might have to upgrade to 2022, will be testing soon.
     
  33. brendanduncan_u3d

    brendanduncan_u3d

    Unity Technologies

    Joined:
    Jul 30, 2019
    Posts:
    437
    @Fillmore The mobile keyboard support was added to 2022. Being a feature that required a number of internal changes, it's unfortunately not something that will be able to be ported to earlier versions.
     
  34. brendanduncan_u3d

    brendanduncan_u3d

    Unity Technologies

    Joined:
    Jul 30, 2019
    Posts:
    437
    @AcePoker You could always override the built-in _JS_MobileKeyboard_Show from a jspre plugin.
     
  35. Arcanebits

    Arcanebits

    Joined:
    Dec 18, 2013
    Posts:
    108
    Hi im into 2022.1.12f1
    Im testing the input/mobile keyb funcionality, my scene loads fine, and placed two inputs fields, i touch them and nothing happens, do I have to invoke somehow?

    A3
     
    EKardelis and Ismaeel370 like this.
  36. Ismaeel370

    Ismaeel370

    Joined:
    Mar 16, 2015
    Posts:
    11
    Using Unity 2022.1.13 and still can't get the keyboard on Android.
     
    azaz26753 likes this.
  37. EKardelis

    EKardelis

    Joined:
    Jul 3, 2021
    Posts:
    1
    @brendanduncan_u3d using Unity 2022.2.0b10, textfield input by UI Toolkit and it always only works after 3-5 fast taps. However, once the keyboard pops up for a particular textfield, it then works just fine with normal 1 tap - but only in the current session. When you reload, it is all over again... I tried on several different android devices with chrome, always the same story.

    Have any tips for what might be wrong in my project?

    And thank you for all the good work!
     
  38. brendanduncan_u3d

    brendanduncan_u3d

    Unity Technologies

    Joined:
    Jul 30, 2019
    Posts:
    437
    @EKardelis Sorry for the late reply, I was on vacation. It sounds like the input system isn't getting proper focus for those 3-5 taps. Can you please file a bug? I know some work has been going into looking into the focus policies of the browser recently. Maybe this issue is related.
     
  39. CodeStarrk

    CodeStarrk

    Joined:
    Jan 5, 2017
    Posts:
    37
    Ok so can someone please tell me which version of Unity this has been battle tested and works. Do I need to set any variables? Will this work only with a particuler TMP version?
     
  40. brianduper

    brianduper

    Joined:
    Nov 12, 2020
    Posts:
    4
    I can confirm that the virtual keyboard now appears when touching inside a TMP input field

    ... i had to upgrade my unity editor to 2022.2.2f1 and my textmeshpro to 3.2.0-pre.4 ... i did notice that my TMP labels look a bit funky now, so i need to investigate that.

    thanks to all
     
    Last edited: Jan 23, 2023
  41. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734
    Switched from 2020.3.34f1 to 2022.2.7f1 to check if the feature working in a webGL project and still NOT working.
    Tested on both iPad& iPhone, Safari & Chrome.

    Keyboard is simply not show while pressing a TMP textfield.

    I'll run more test tomorrow.

    Anyone?

    EDIT : Actually TextMeshPro 3.06 is the last update and from 3.0.6 · April 22, 2021....
    Shouldn't there some TMP package update since? o_O...
     
    Last edited: Feb 18, 2023
  42. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734
    How did you manage to get that package version?
    Tried the com.unity.textmeshpro@3.2 from the custom package name import field but nothing is coming...

    Screenshot 2566-02-19 at 02.38.08.png

    EDIT 1 : It seems 4.0 pre1 is available...
    Tried to modify the package manager json and restart Unity but obliviously didn't like it... :D

    Screenshot 2566-02-19 at 02.46.38.png

    EDIT 2 : ok so I ignore safe more on restart, package manager showing up. TextMesh is F***ed...
    .... and offer to update to 4.0.0 pre-2 :D
    How amazing is that...

    Screenshot 2566-02-19 at 02.49.13.png

    Obviously TMP_FontAsset is depreciated in 4.0...
    - https://docs.unity3d.com/Packages/com.unity.textmeshpro@4.0/api/TMPro.TMP_FontAsset.html
    .... fixed the code... but whole font assets are F***ed... nice support! :D

    EDIT 3 : It's funny cause even creating a default TMP Text won't draw any character...

    EDIT 4 : Simply delete the TextMesh Pro (Essential Resources folder) and import it again.

    Then finally yes the Keyboard is showing up on device using the TMP-InputField.
     
    Last edited: Feb 19, 2023
  43. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    so bottom line is unity 2021 doesn't get this?
     
  44. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734
    xucian and Thaina like this.
  45. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    famous last words
     
  46. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    Last edited: Feb 24, 2023
    fxlange and Thaina like this.
  47. brendanduncan_u3d

    brendanduncan_u3d

    Unity Technologies

    Joined:
    Jul 30, 2019
    Posts:
    437
    Can you file a bug for it so it doesn't get lost? Definitely want to get that fixed.

     
  48. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    hi! thanks for the interest!

    just curious, how do you plan to solve this? I see solutions like temporarily switching between the types. seems it's not that trivial, but from what I've read it's doable (not a JS expert here).

    Also, just went on a bug reporting rampage related to TMPro & WebGL (the 1st one is the email issue):
    IN-33303
    IN-33305
    IN-33306
    IN-33307
    IN-33311
     
    Thaina likes this.
  49. brendanduncan_u3d

    brendanduncan_u3d

    Unity Technologies

    Joined:
    Jul 30, 2019
    Posts:
    437
    @thefallengamesstudio I don't actually work in that area any more, but some great developers do, and I will bring it up with them to make sure to check on the state of the mobile keyboard. Thanks for the tickets. The mobile web keyboard has always been a pain, relying on hacks more than anything because of the lack of any keyboard API for the web. But I'm sure a solution can be found.
     
  50. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734
    Tried tmp 4.0?
     
    xucian likes this.