Created
April 28, 2017 18:15
-
-
Save kalineh/ac8140accc38a26fbc63b4ade81729a8 to your computer and use it in GitHub Desktop.
Toggle game window maximized state (ctrl+M).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEditor; | |
using System.Reflection; | |
namespace FunktronicLabs | |
{ | |
#if UNITY_EDITOR | |
public class EditorMaximizeGameWindow | |
{ | |
[MenuItem("Tools/Maximize Game Window %M")] | |
public static void MaximizeGameWindow() | |
{ | |
var assembly = Assembly.GetAssembly(typeof(Editor)); | |
var type = assembly.GetType("UnityEditor.GameView"); | |
var property = type.GetProperty("maximized"); | |
var window = EditorWindow.GetWindow(type); | |
var maximized = (bool)property.GetValue(window, null); | |
property.SetValue(window, (object)(!maximized), null); | |
} | |
} | |
#endif | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you, but It does not work on undocked window