Created
March 27, 2020 16:23
-
-
Save fnuecke/d4275087cc7969257eae0f939fac3d2f to your computer and use it in GitHub Desktop.
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
#if UNITY_EDITOR | |
using System; | |
using System.Reflection; | |
using UnityEditor; | |
using UnityEngine; | |
/// <summary> | |
/// Little utility for opening a "Game" view in fullscreen. Will be opened on whatever Unity thinks is the "main" | |
/// monitor at the moment. The hotkey will toggle the window; however, if for some reason this breaks, fullscreen | |
/// windows can be closed via Alt+F4 as long as the editor is not in play mode. | |
/// </summary> | |
/// <remarks> | |
/// Confirmed to work in Unity 2019 and 2020. May work in earlier and later versions. No promises. | |
/// </remarks> | |
public static class FullscreenGameView | |
{ | |
static readonly Type GameViewType = Type.GetType("UnityEditor.GameView,UnityEditor"); | |
static readonly PropertyInfo ShowToolbarProperty = GameViewType.GetProperty("showToolbar", BindingFlags.Instance | BindingFlags.NonPublic); | |
static readonly object False = false; // Only box once. This is a matter of principle. | |
static EditorWindow instance; | |
[MenuItem("Window/General/Game (Fullscreen) %#&2", priority = 2)] | |
public static void Toggle() | |
{ | |
if (GameViewType == null) | |
{ | |
Debug.LogError("GameView type not found."); | |
return; | |
} | |
if (ShowToolbarProperty == null) | |
{ | |
Debug.LogWarning("GameView.showToolbar property not found."); | |
} | |
if (instance != null) | |
{ | |
instance.Close(); | |
instance = null; | |
} | |
else | |
{ | |
instance = (EditorWindow) ScriptableObject.CreateInstance(GameViewType); | |
ShowToolbarProperty?.SetValue(instance, False); | |
var desktopResolution = new Vector2(Screen.currentResolution.width, Screen.currentResolution.height); | |
var fullscreenRect = new Rect(Vector2.zero, desktopResolution); | |
instance.ShowPopup(); | |
instance.position = fullscreenRect; | |
instance.Focus(); | |
} | |
} | |
} | |
#endif |
That worked indeed (nothing else did and was not easy to get hold to the
editor window below 😅)
Thank you
…On Wed, 9 Jul 2025, 03:41 StevenLightning, ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
I entered fullscreen by mistake while outside PlayMode... Now I have this
screen thing stuck that I cannot get rid off. I even removed the script
from my project but it still doesn't go away ...
how can I get rid of this full screen view :S
Thank in advance.
If nothing else works, you can open the Window menu at the top of the main
screen and go to Layouts -> Reset All Layouts. That should take you back to
the default for all windows.
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/fnuecke/d4275087cc7969257eae0f939fac3d2f#gistcomment-5668329>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABN3IOT5NDKGSXHZJP2UTVL3HR6MPBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVEYTAMRQGMZTAMZRU52HE2LHM5SXFJTDOJSWC5DF>
.
You are receiving this email because you commented on the thread.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can open the Window menu at the top of the main screen, go to Layouts, and then select one of the options there. If nothing else works, from the same menu you can try Reset All Layouts. That should take you back to the default for all windows, but it will also delete your custom layouts.