以下の内容はhttps://baba-s.hatenablog.com/entry/2023/09/04/151135より取得しました。


【Unity】Screen のサイズが変化したかどうかを検知するコンポーネント

ソースコード

using System;
using UnityEngine;

namespace Kogane
{
    [DisallowMultipleComponent]
    internal sealed class ScreenSizeChecker : MonoBehaviour
    {
        private int m_width;
        private int m_height;

        public event Action OnChanged;

        private void Awake()
        {
            m_width  = Screen.width;
            m_height = Screen.height;
        }

        private void Update()
        {
            if ( OnChanged == null ) return;
            if ( m_width == Screen.width && m_height == Screen.height ) return;

            m_width  = Screen.width;
            m_height = Screen.height;

            OnChanged();
        }
    }
}



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

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