Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

TextMesh Pro Hide Mobile Input... does not work

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

  1. millefoliumink

    millefoliumink

    Joined:
    Aug 28, 2014
    Posts:
    139
    Any timescale on this fix being available in 2018.3? Got two apps waiting on this issue and would rather not port to newer versions of Unity due to plugins...
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I'll ask the mobile team for an ETA on 2018.3.
     
    igor_rst and millefoliumink like this.
  3. millefoliumink

    millefoliumink

    Joined:
    Aug 28, 2014
    Posts:
    139
    Anything on the horizon? :)
     
  4. Anoa

    Anoa

    Joined:
    Apr 1, 2016
    Posts:
    9
    Hello, I've also got this problem. The hide mobile input doesn't work in Android, I've check it but the input field above the virtual keyboard still appears.
     
  5. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    As per my post above, this should have been fixed in 2019.1 but not yet in 2018.3.
     
  6. luminal23

    luminal23

    Joined:
    Sep 4, 2018
    Posts:
    6
    Hi, another folk here waiting for the patch on this, keep the good work, we hope it will be out soon
     
    millefoliumink likes this.
  7. imaewyn

    imaewyn

    Joined:
    Apr 23, 2016
    Posts:
    211
    Is any news about fix for Android?
     
    weltbesterbatman likes this.
  8. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Just letting everyone know the Android team has a PR under review for 2018.3. Not sure when this will get approved but it is moving forward.
     
  9. milosstamenkovic95

    milosstamenkovic95

    Joined:
    Oct 12, 2017
    Posts:
    1
    It's great to hear that. I'm also working on a project with version 2018.3, and currently waiting for this fix.
     
  10. Ashindimir

    Ashindimir

    Joined:
    Jan 15, 2016
    Posts:
    1
    I'm in the same boat :) Hope approval comes soon!
     
  11. TobiWoVR

    TobiWoVR

    Joined:
    Mar 1, 2018
    Posts:
    3
    Same here! This bug is especially annoying in VR as well. The mobile Input field appears as a green box in the lower field of view. Theres no way to turn it off right now. The fix should definitely be ported to 2018.4 LTS (Long Term Support)!
    Can you please provide us information on when this will be approved/released?
     
    Last edited: Jun 4, 2019
  12. weltbesterbatman

    weltbesterbatman

    Joined:
    Oct 1, 2013
    Posts:
    11
    We are also waiting for this.
     
    millefoliumink likes this.
  13. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The back port landed yesterday. This will be available in 2018.4.3f.
     
    millefoliumink likes this.
  14. millefoliumink

    millefoliumink

    Joined:
    Aug 28, 2014
    Posts:
    139
    Thanks for letting us know, looking forward to it.
     
  15. joseGuate97

    joseGuate97

    Joined:
    Mar 1, 2018
    Posts:
    57
    Was this feature finally accomplished?
     
  16. RobinopdeBeek

    RobinopdeBeek

    Joined:
    Jan 17, 2018
    Posts:
    23
    I can hide the mobile input on Android using 'Hide Mobile Input', but then the back button stops working... The app becomes non-responsive and I need to type something on the keyboard again for the app start working again.

    (The back button works fine when the 'Hide Mobile Input' is off)

    Unity version 2019.4.5
    on Google Pixel 2
     
  17. Gasiek

    Gasiek

    Joined:
    Feb 18, 2019
    Posts:
    2
    When I use "hide mobile input", it works on some android phones and on at least one of them, the keyboard doesn't show up. I'm using Unity 2020.1..8f1. It doesn't work on OPPO RENO 4 LITE CPH2125 with Android 11. I have no idea what could be a problem, and if it's the only phone on which this doesn't work (I guess not). If i disable hide input, the keyboard shows up correctly.
     
  18. Femidko

    Femidko

    Joined:
    Aug 4, 2013
    Posts:
    57
    With Unity 2020.1.15f/TMP 3.0.3 the input field is hidden, but when you click in the place where the input field should be, such a selection occurs
    upload_2021-10-8_14-14-24.png

    Can you suggest anything?
     
  19. frozenmangotree

    frozenmangotree

    Joined:
    May 2, 2020
    Posts:
    14
    I can't even get mine this far how do you get it like that even? Would love to know how you did it please.
     
  20. JonathanFri

    JonathanFri

    Joined:
    Jul 3, 2019
    Posts:
    13
    Same issue on 2020.3.16. Did you find a solution?

    Edit: https://unity3d.com/unity/whats-new/2020.3.18 fixes that
     
    Last edited: Jan 7, 2022
  21. TheVirtualMunk

    TheVirtualMunk

    Joined:
    Sep 6, 2019
    Posts:
    150
    So I have made/found a custom script for moving my RectTrans up when the keyboard pops up:
    Code (CSharp):
    1. public class AdaptToVirtuelKeyboard : MonoBehaviour
    2. {
    3.     [SerializeField, HideInInspector]
    4.     private RectTransform rectTransform;
    5.  
    6.     [SerializeField]
    7.     private int debugKeyboardHeight;
    8.     private void OnValidate()
    9.     {
    10.         rectTransform = GetComponent<RectTransform>();
    11.     }
    12.     void Update()
    13.     {
    14.         int relativeKeyboardHeight;
    15.         if (Application.isPlaying)
    16.             relativeKeyboardHeight = VirsabiUtility.GetRelativeKeyboardHeight(rectTransform, true);
    17.         else
    18.             relativeKeyboardHeight = debugKeyboardHeight;
    19.  
    20.         rectTransform.anchoredPosition = new Vector2(0, relativeKeyboardHeight);
    21.     }
    22.  
    23.     public static int GetRelativeKeyboardHeight(RectTransform rectTransform, bool includeInput)
    24.     {
    25.          int keyboardHeight = GetKeyboardHeight(includeInput);
    26.          float screenToRectRatio = Screen.height / rectTransform.rect.height;
    27.          float keyboardHeightRelativeToRect = keyboardHeight / screenToRectRatio;
    28.  
    29.          return (int)keyboardHeightRelativeToRect;
    30.     }
    31.  
    32. private static int GetKeyboardHeight(bool includeInput)
    33.         {
    34. #if UNITY_EDITOR
    35.             return 0;
    36. #elif UNITY_ANDROID
    37.             using (AndroidJavaClass unityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
    38.             {
    39.                 AndroidJavaObject unityPlayer = unityClass.GetStatic<AndroidJavaObject>("currentActivity").Get<AndroidJavaObject>("mUnityPlayer");
    40.                 AndroidJavaObject view = unityPlayer.Call<AndroidJavaObject>("getView");
    41.                 AndroidJavaObject dialog = unityPlayer.Get<AndroidJavaObject>("mSoftInputDialog");
    42.                 if (view == null || dialog == null)
    43.                     return 0;
    44.                 var decorHeight = 0;
    45.                 if (includeInput)
    46.                 {
    47.                     AndroidJavaObject decorView = dialog.Call<AndroidJavaObject>("getWindow").Call<AndroidJavaObject>("getDecorView");
    48.                     if (decorView != null)
    49.                         decorHeight = decorView.Call<int>("getHeight");
    50.                 }
    51.                 using (AndroidJavaObject rect = new AndroidJavaObject("android.graphics.Rect"))
    52.                 {
    53.                     view.Call("getWindowVisibleDisplayFrame", rect);
    54.                     return Screen.height - rect.Call<int>("height") + decorHeight;
    55.                 }
    56.             }
    57. #elif UNITY_IOS
    58.             return (int)TouchScreenKeyboard.area.height;
    59. #endif
    60.         }
    61. }

    This is nice as the background can stay locked while only the relevant UI is moved.

    But when using "Hide Mobile Input" the screen is still pushed up.
    And when setting the content type to AutoCorrected, you can see on build that the lines are still there. It's just the background and the text that is not rendered. The lines are still extending the rect of the native keyboard....

    This honestly looks like whoever made the native integration did a quick hack of hiding the text and background rather than a sound solution?

    upload_2022-1-21_11-37-21.png

    Edit:
    I made a bool to try disabling "includeInput" from the movement and that works but the lines still shows up;
    upload_2022-1-21_12-9-12.jpeg
     
    Last edited: Jan 21, 2022
  22. TheVirtualMunk

    TheVirtualMunk

    Joined:
    Sep 6, 2019
    Posts:
    150
    Bumping for notification.
     
  23. LexaMV

    LexaMV

    Joined:
    Feb 20, 2018
    Posts:
    28