Skip to content

【Unity】Android でもソフトウェアキーボードの表示領域を取得できるパッケージ

License

Notifications You must be signed in to change notification settings

baba-s/UniSoftwareKeyboardArea

Repository files navigation

Uni Software Keyboard Area

Android でもソフトウェアキーボードの表示領域を取得できるパッケージ

使用例

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)

謝辞

About

【Unity】Android でもソフトウェアキーボードの表示領域を取得できるパッケージ

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages