以下の内容はhttps://baba-s.hatenablog.com/entry/2020/10/23/090000より取得しました。


【Unity】Android でもソフトウェアキーボードの表示領域を取得できるパッケージ「UniSoftwareKeyboardArea」を GitHub に公開しました

リポジトリ

使用例

using UniSoftwareKeyboardArea;
using UnityEngine;
using UnityEngine.UI;

public class Test : MonoBehaviour
{
    public CanvasScaler m_canvasScaler;
    public RectTransform m_rectTransform;

    private void Update()
    {
        var rate = m_canvasScaler.referenceResolution.y / Screen.height;
        var pos = m_rectTransform.anchoredPosition;
        pos.y = SoftwareKeyboardArea.GetHeight( true ) * rate;
        m_rectTransform.anchoredPosition = pos;
    }

    private void OnGUI()
    {
        GUILayout.Label( SoftwareKeyboardArea.GetHeight( true ).ToString() );
    }
}

Image (18)

謝辞




以上の内容はhttps://baba-s.hatenablog.com/entry/2020/10/23/090000より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14