Search Unity

TextMesh Pro Hide Mobile Input... does not work

Discussion in 'Unity UI & TextMesh Pro' started by Player7, Jul 4, 2017.

  1. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,286
    Has no effect, on screen mobile keyboard shows up regardless.

    tested on 2017.1 (android)
     
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    2,267
    I believe this is an issue on Android where you cannot hide the mobile keyboard.
     
  3. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,286
    well the workaround is not to call "TouchScreenKeyboard.Open" if "shouldHideMobileInput" is true... as "TouchScreenKeyboard.hideInput = shouldHideMobileInput" is not working from what I'm finding.
     
  4. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    2,267
    Were you able to test this on your end?

    I am traveling for most of the day today but I'll try to take a look when I get to my destination.
     
  5. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,286
    yes that adjustment worked, don't suppose you plan to make a much more customizable virtual onscreen keyboard for unity? :D

    I just found the device OS one to be a bit overkill in screenspace taken up for the input required.
     
  6. rgonsalv

    rgonsalv

    Joined:
    Sep 29, 2016
    Posts:
    23
    This still does not work in the free version of TMPro, running on Android/Unity5.6.
     
  7. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    2,267
    This is not a limitation of TMP but a limitation with regards to features available to TMP. The Unity mobile team is working on improving their API to provide more functionality so that such features can be supported on all platforms.
     
  8. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,286
    Is this fixed now?
     
  9. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,286
    ok.. just tested.. no it still does not .<{"!"}{!$ing work ...how long will this take.. even setting the input field to read only and disable mobile keyboard.. on the tmp input component.. and the mobile keyboard pops up.. this is just stupid and I can't believe it has been a over year since reported.
     
  10. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    2,267
    I am working on the Input Field right now but like I said before this isn't specific to TMP but to the Android API available via the Input class.

    This "shouldHideMobileInput" from what I am told is only supposed to hide the part of the virtual keyboard where you can edit the input. Ie. it is not supposed to hide the virtual keyboard or prevent it from showing up which as what I thought this property was supposed to do in the first place.

    The following "android:windowSoftInputMode="stateAlwaysHidden" can also be added to an AndroidManifest.xml but it doesn't appear to prevent the virtual keyboard from showing up either.

    I have brought this up again to the mobile team to see if there is an ETA on if / when this functionality can be supported.

    In the meantime and like I said, I am working on the Input Field so maybe I can come up with some alternative way to get around this. Just to confirm, you want to complete suppress / prevent the virtual keyboard from showing up not just the single line above the virtual keyboard that allows inline editing of the text.
     
    Last edited: Dec 22, 2018
  11. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,286
    Yes complete suppression, am doing my custom virtual keyboard for it, just the android one you have very little control over layout and its positioning which is pretty annoying..almost think unity should do a custom keyboard that can be customized a lot more than the default built in os keyboard.
     
  12. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    2,267
    How are you feeding the character input from your virtual keyboard to the Input Field? Ie. by updating the text on the Input Field or creating / simulating KeyDown events and calling ProcessEvent()?

    P.S. Did some testing and should be able to control the handling of showing the virtual keyboard by the Input Field itself.

    Update - This will need further testing but ... assuming all goes well.

    upload_2018-12-22_16-15-7.png
     
    Last edited: Dec 23, 2018
  13. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,286
    How are you feeding the character input from your virtual keyboard to the Input Field?

    yeh I feed the virtual button inputs into an event that just adds the characteriinput field

    "Ie. by updating the text on the Input Field or creating / simulating KeyDown events and calling ProcessEvent()?"

    You have a code example on that, my next plan was to capture actual desktop keyboard input and have the virtual ugui keyboard visually show keypress on the buttons.

    Is this version in a package I can test with now?
     
  14. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    2,267
    This will be available in the next package release which should be available in the next 7 to 10 days (sort of influx due to holidays).
     
  15. Little-Big-Monkey

    Little-Big-Monkey

    Joined:
    Mar 4, 2014
    Posts:
    34
    I have the exact same problem, but on ios. Will it work for this platform too ?
    I'm also interested in an example of how to simulate key down events.
     
    Last edited: Dec 24, 2018
  16. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,286
    What is the difference between 'hide mobile input' and 'hide mobile keyboard' seems like it should be the same thing no?
     
  17. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    2,267
    Hide mobile input hides the single text field (red box as seen blow) above the virtual keyboard. This allows key input but in the game screen Input Field.

    upload_2018-12-24_14-4-21.png

    Hide mobile keyboard will hide the entire virtual keyboard.
     
  18. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    2,267
    Hide mobile input should be working as expected on iOS. This new hide mobile keyboard option should also work on all mobile platforms.

    The following would simulate a key input.

    Code (csharp):
    1.  
    2. Event e = new Event();
    3. e.character = 'e';
    4. e.keyCode = KeyCode.E;
    5. e.type = EventType.KeyDown;
    6.  
    7. m_InputFieldComponent.ProcessEvent(e);
    8. m_InputFieldComponent.ForceLabelUpdate();
    9.  
     
  19. Little-Big-Monkey

    Little-Big-Monkey

    Joined:
    Mar 4, 2014
    Posts:
    34
    Thank you, it's really interesting.
    But I will stick to my own solution, because it does not manage the caret position.
     
  20. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,286

    will it be out this week?
     
  21. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    2,267
    I am working on it. I also ran into issue with IME which I would like to address as well.
     
  22. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,286
    IME?
     
  23. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    2,267
  24. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,286
    Will it be out this week?
     
  25. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    2,267
    I am getting close but would like to get some repros / simple test scenes from some of you to enable me to further test this to make sure I didn't overlook anything and that is behaves as expected.
     
  26. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,286
    I don't have anything small to do that old bug reports could test this? soon as its out will give it a test and see if the main issue of androids keyboard doesn't show up when clicking on any input and instead just my own overlay one (which still needs more work but I haven't really done much with it since this issue has been in the way)
     
  27. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,286
    Will it be this week?
     
  28. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    2,267
    If not, I'll go for a preview release.
     
  29. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,286
    will the preview be out before the weekend? yes I really want to try this out :D
     
  30. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    2,267
    Working on it... ran into an issue with UWP but it is looking good now.

    I'll provide an update tomorrow.
     
  31. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,286
    I fear its not gonna be ready for the weekend?
     
  32. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    2,267
    Still working on it and will be working on it over the weekend as well (if needed) to get this released.

    P.S. Check your PM.
     
  33. lorddanger

    lorddanger

    Joined:
    Aug 8, 2015
    Posts:
    60
  34. johmaxgro

    johmaxgro

    Joined:
    Oct 3, 2018
    Posts:
    10
    I am facing the same problem here.

    Besides the https://github.com/mopsicus/UnityMobileInput works also for for me to hide input+keyboard but only in 2D space.

    Would need to use input field in world space and hide the input box+keyboard.
     
  35. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    2,267
    I added the ability to hide the Mobile / Soft Keyboard in the next release of the TMP Input Field.

    Hiding of the mobile input (input field above the soft keyboard) will requires changes in Unity but I requested those be done.

    I will take a look at the above Github.
     
  36. lorddanger

    lorddanger

    Joined:
    Aug 8, 2015
    Posts:
    60
    So it will require a new version of Unity or just the updated TMP package.

    And when we can expect the release ?
     
  37. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    2,267
    This TMP Input Field change will be included in the next release of the TMP package which will be version 1.4.0. This new package also includes the new Dynamic SDF system which does require Unity 2018.3.

    A preview of this next release should be available early next week.
     
    Last edited: Jan 26, 2019
    lorddanger likes this.
  38. jk314

    jk314

    Joined:
    Jun 23, 2011
    Posts:
    45
    Something to try:

    Code (CSharp):
    1. InputText.keyboardType = (TouchScreenKeyboardType) (-1);
    It worked for me. Unity 2018.2.16f
     
  39. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    2,267
    That ends up producing errors on the device.

    I have added support to hide the Soft Keyboard to the TMP Input Field. Look for this new functionality in the next release of the TMP package.
     
  40. Beex

    Beex

    Joined:
    Sep 2, 2012
    Posts:
    7
    Hide Mobile Input still doesn't work in TMP 1.4.0 and Unity 2018.3.1
     
  41. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    2,267
    Correct. The hiding of the single line input field above the soft keyboard on Android will require a change in Unity itself. This change is something the Mobile / Android team are in the process of making.

    I did add the ability to hide the soft keyboard itself completely via the Hide Soft Keyboard toggle in the Inspector and property.
     
  42. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,286
    Will it be updated for 2019.1 as a package soon?
     
  43. vonbetelgeuse

    vonbetelgeuse

    Joined:
    Aug 28, 2014
    Posts:
    121
    Also looking for a fix to hide the Input box that appears above the keyboard. Hide Mobile Input doesn't appear to do anything.
     
  44. beverbende

    beverbende

    Joined:
    Mar 23, 2017
    Posts:
    1
    Finally found the thread with people having the same problem :D
    I too have not been able to solve the issue with touchscreenkeyboard.hideinput, to remove the single line input field when the keyboard is displayed..
    @Stephan_B thanks a lot for looking into this problem, since many people are also trying to create goodworking mobile apps with unity :D

    When do you expect there to be a solution? or in what update?
     
  45. Bunderant

    Bunderant

    Joined:
    May 29, 2013
    Posts:
    11
    It's excellent to hear is issue is finally being addressed.

    I've seen a lot of talk in general about the hiding the mobile input field only working when the input type is set to "Single Line". Am I right to assume that the upcoming changes we're talking about will also allow us to hide the mobile input field with multi-line options? And have control over the caret?

    The biggest input field grievances I've had to date are that, the lack of a "line count" limit, and lack of more robust options to handle the interrelationship of spaces, word wrapping, and the automatic scrolling/masking of the input field. Type a word into an input field followed by spaces beyond the edge of the input field to see what I mean (using TMP, that is).
     
  46. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    2,267
    The hide mobile input should control / hide the input field above the virtual keyboard. I believe it will do that regardless of single or multi line mode. The behavior of this feature is in the hands of the Mobile / Android folks at Unity but I'll be more than happy to follow up with them, if this feature needs further tweaking.

    In terms of the other items you reference, please provide me with a detail list and examples of how it currently behaves vs. what you would like. Next time, I have to make tweaks to the Input Field, I'll come back to these posts to make sure I address / try to add the requested functionality.
     
  47. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,286
    Are these changes in the 1.40 preview???
     
  48. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    2,267
    Yes in regards to the parts specific to the TMP Input Field.

    In regards to the Android specific stuff, I believe it is in the latest 2019.1 beta and is scheduled to be backported to 2018.3 (not sure of ETA on 2018.3 backport).
     
  49. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,286
    Well I'm using 2019.2a6 so I guess when I open the android project I can finally give all this stuff a test then.
     
  50. igor_rst

    igor_rst

    Joined:
    Apr 20, 2017
    Posts:
    14
    So, that means you don't know when and in which version of Unity this feature will be added? Right? Now just added support to TMP?

    BTW, https://github.com/mopsicus/UnityMobileInput it is my repo ) Currently only this hack can help me. If it will be in Unity (hope it) – great!