コガネブログ

平日更新を目標に Unity や C#、Visual Studio、ReSharper などのゲーム開発アレコレを書いていきます

【Unity】スクリプトから Game ビューを最大化する方法

概要

using System;
using UnityEditor;

internal static class Example
{
    [MenuItem( "hoge/hoge" )]
    private static void Hoge()
    {
        var type         = Type.GetType( "UnityEditor.GameView,UnityEditor" );
        var editorWindow = EditorWindow.GetWindow( type );

        if ( editorWindow == null ) return;

        editorWindow.maximized = true;
    }
}