ソースコード
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(); } } }