ソースコード
using System;
using UnityEngine;
namespace Kogane
{
[DisallowMultipleComponent]
internal sealed class GameViewMaximizedChecker : MonoBehaviour
{
#if UNITY_EDITOR
private UnityEditor.EditorWindow m_gameView;
private bool m_maximized;
public event Action OnChanged;
private void Awake()
{
var assembly = typeof( UnityEditor.EditorWindow ).Assembly;
var type = assembly.GetType( "UnityEditor.GameView" );
m_gameView = UnityEditor.EditorWindow.GetWindow( type );
m_maximized = m_gameView.maximized;
}
private void Update()
{
if ( OnChanged == null ) return;
if ( m_maximized == m_gameView.maximized ) return;
m_maximized = m_gameView.maximized;
OnChanged();
}
#endif
}
}