Skip to content

Latest commit

 

History

History
37 lines (28 loc) · 1 KB

README.md

File metadata and controls

37 lines (28 loc) · 1 KB

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)

謝辞