在移动键盘上方显示输入字段

Show input field above keyboard mobile

移动设备上的常见用户体验案例是在键盘出现时让视图神奇地滚动,以便输入字段在键盘上方保持可见

Xamarin、ios 或 android 等移动 sdk 将在本机提供该功能。

Unity中会有这样的命令吗?

我可以考虑一个默认位置并使 canvas/scroll 视图相应地移动,但也许已经有一些东西了。

据我所知,这种行为根本不是 Unity 中的 native

不过,您可以使用 TouchScreenKeyboard.visible 检测键盘是否在屏幕上,并根据需要自行修改用户体验。

TouchScreenKeyboard class 上的文档说:

TouchScreenKeyboard.visible and TouchScreenKeyboard.area should be used to determine if the keyboard is being shown (activated) and what portion of the screen is using.

所以我最终找到了这个

https://forum.unity.com/threads/move-ui-above-touchkeyboard-for-mobile.353493/

我还没有尝试过该代码,但这已接近解决方案。