But if I use 1366 * 768 laptops (mostly be this), and if I hit play button for testing in unity editor, game screen does not become full screen mode even if I press the right-above’s full screen button.
How can I see unity editor’s game screen as a full screen?
I mean not standalone or webplayer, but unity editor itself’s game screen. so that I can test frequently in full screen mode even at 1366 * 768 laptops.
That’s actually a good question, I’ve run into the same situation myself. I’ve got a dual screen system so I just grab the “Game” view window and drag it to the second monitor and stretch it to the size I want. You could probably write an editor script that would do the same thing. Otherwise, you’ll have to build a stand alone and run it to view it at the fullscreen resolution. If there’s another (better) way to do it I’m all ears.
I don’t know if that’s possible. What I typically do is drag the game view window to a screen that is larger than the size I need and then manually drag the corners until it’s roughly the size I need.
Right, I understand your question. I don’t know if that’s possible to do with an editor script. You may be able to drag and stretch the window so it’s contents fill the vertical height of the screen. If not, you may have to preview by building a stand alone. I don’t know of any good / easy solution to the problem, that’s why I said it was a good question.
You can’t (maximize on play is the closest you can get), but it shouldn’t make any difference. All you need is the aspect ratio, not the exact number of pixels. You’re using a 3D engine, so that usually means the game should run in any resolution. Ideally you should make it run in any aspect ratio too.
True, except on those projects which require a specific screen resolution to be supported, which is what I’m thinking the OP is asking about. Ideally in that particular situation you have the monitor that the project will be playing on for design and testing purposes.
I use it because I need to video record the screen on portrait mode and it helped wonders. It does work full screen, however, if you do record the video, it will record with the Game window top bar.
the script is nice but it always changed my ‘standalone’ resolution to ‘free aspect’ (+ it closes the game window too often) - here’s my cleaned up version that behaves much nicer
using UnityEditor;
using UnityEngine;
using System.Collections.Generic;
[InitializeOnLoad]
public class FullscreenPlayMode : MonoBehaviour {
//The size of the toolbar above the game view, excluding the OS border.
private static int tabHeight = 22;
private static Dictionary<string, Vector2> settings = new Dictionary<string, Vector2> {
{"mnml", new Vector2(1920,0)} // sharing your code? offsets go in here!
};
static FullscreenPlayMode() {
if (settings.ContainsKey(System.Environment.UserName)) {
EditorApplication.playmodeStateChanged -= CheckPlayModeState;
EditorApplication.playmodeStateChanged += CheckPlayModeState;
}
}
static void CheckPlayModeState() {
// looks strange, but works much better!
if (EditorApplication.isPlaying) {
if (EditorApplication.isPlayingOrWillChangePlaymode) {
FullScreenGameWindow();
} else {
CloseGameWindow();
}
}
}
static EditorWindow GetMainGameView() {
EditorApplication.ExecuteMenuItem("Window/Game");
System.Type T = System.Type.GetType("UnityEditor.GameView,UnityEditor");
System.Reflection.MethodInfo GetMainGameView = T.GetMethod("GetMainGameView", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
System.Object Res = GetMainGameView.Invoke(null, null);
return (EditorWindow)Res;
}
static Rect orig;
static Vector2 min;
static Vector2 max;
static void FullScreenGameWindow() {
EditorWindow gameView = GetMainGameView();
Rect newPos = new Rect(0, 0 - tabHeight, Screen.currentResolution.width, Screen.currentResolution.height + tabHeight);
newPos.position = newPos.position + settings[System.Environment.UserName];
orig = gameView.position;
min = gameView.minSize;
max = gameView.maxSize;
gameView.position = newPos;
gameView.minSize = new Vector2(Screen.currentResolution.width, Screen.currentResolution.height + tabHeight);
gameView.maxSize = gameView.minSize;
gameView.position = newPos;
}
static void CloseGameWindow() {
EditorWindow gameView = GetMainGameView();
gameView.position = orig;
gameView.minSize = min;
gameView.maxSize = max;
gameView.position = orig;
}
}
the code of @mnml seems to work, but only a few times. After a couple of times starting the game preview, the windows disappears completly and Ive got some “Scene out of view-frustrum” errors. To resolve this, I need to remove the script, restart the Unity (or sometimes Windows) and then close and open the game preview window again.
I think my video could help you. You can change play mode screen to exactly your screen size without limiting the physical screen size. This is some undocumented stuff but it works for me.
isnt this more or less the same like mnml did, only with screenshot capability added?
And I need it for testing touchscreen-inputs. I have a dedicated touch-screen on which I test everything. And the inputs of the screen are not scaled down to the downscaled preview, so everything is misaligned during a preview (or I have to scale it up to 1x, but then the game-borders are hidden behind the preview-window-borders.