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?
We are also waiting for this.
The back port landed yesterday. This will be available in 2018.4.3f.
Thanks for letting us know, looking forward to it.
Was this feature finally accomplished?
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
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.
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
Can you suggest anything?
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.
Same issue on 2020.3.16. Did you find a solution?
Edit: https://unity3d.com/unity/whats-new/2020.3.18 fixes that
So I have made/found a custom script for moving my RectTrans up when the keyboard pops up:
public class AdaptToVirtuelKeyboard : MonoBehaviour
{
[SerializeField, HideInInspector]
private RectTransform rectTransform;
[SerializeField]
private int debugKeyboardHeight;
private void OnValidate()
{
rectTransform = GetComponent<RectTransform>();
}
void Update()
{
int relativeKeyboardHeight;
if (Application.isPlaying)
relativeKeyboardHeight = VirsabiUtility.GetRelativeKeyboardHeight(rectTransform, true);
else
relativeKeyboardHeight = debugKeyboardHeight;
rectTransform.anchoredPosition = new Vector2(0, relativeKeyboardHeight);
}
public static int GetRelativeKeyboardHeight(RectTransform rectTransform, bool includeInput)
{
int keyboardHeight = GetKeyboardHeight(includeInput);
float screenToRectRatio = Screen.height / rectTransform.rect.height;
float keyboardHeightRelativeToRect = keyboardHeight / screenToRectRatio;
return (int)keyboardHeightRelativeToRect;
}
private static int GetKeyboardHeight(bool includeInput)
{
#if UNITY_EDITOR
return 0;
#elif UNITY_ANDROID
using (AndroidJavaClass unityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
{
AndroidJavaObject unityPlayer = unityClass.GetStatic<AndroidJavaObject>("currentActivity").Get<AndroidJavaObject>("mUnityPlayer");
AndroidJavaObject view = unityPlayer.Call<AndroidJavaObject>("getView");
AndroidJavaObject dialog = unityPlayer.Get<AndroidJavaObject>("mSoftInputDialog");
if (view == null || dialog == null)
return 0;
var decorHeight = 0;
if (includeInput)
{
AndroidJavaObject decorView = dialog.Call<AndroidJavaObject>("getWindow").Call<AndroidJavaObject>("getDecorView");
if (decorView != null)
decorHeight = decorView.Call<int>("getHeight");
}
using (AndroidJavaObject rect = new AndroidJavaObject("android.graphics.Rect"))
{
view.Call("getWindowVisibleDisplayFrame", rect);
return Screen.height - rect.Call<int>("height") + decorHeight;
}
}
#elif UNITY_IOS
return (int)TouchScreenKeyboard.area.height;
#endif
}
}
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?
Edit:
I made a bool to try disabling âincludeInputâ from the movement and that works but the lines still shows up;
Bumping for notification.
UP!
Reviving this old thread since Iâve experiencing this very same issue on Unity 2022.3.20f1 and TMP package 3.0.6⌠Has anyone noticed this issue on some Android devices as well and found a solution?
Pretty funny researching an issue in an old thread and running into another who is recently still running into the same problem. Unfortunately, Iâm still looking around myself, sorry if you see a notification for a reply to your message and are still not met with an answer.
Unity needs to have better mobile keyboard support.
And like years ago, my plugin still works and solves this problem)) GitHub - mopsicus/umi: Unity mobile input (UMI) plugin for Android and iOS, allows to use features of mobile native input fields