- Home /
Why does Editor play scale default to 2x
Every time I update Unity, start a new instance of the Editor, and sometimes even hit the play button, the scale of the game window goes to 2x. This is obnoxious. I do not want to zoom in, but Unity feels the need to show me a magnified part of my game.
Is there a way to prevent this or set some sort of hard-coded default?
The 1x setting obviously isn't being stored and defaulting to 2x seems pointless.
Having this same issue - and what's worse, this scale persists after building.
What version are you using? Nonetheless, it's funny, because I've been filing a bug report about the zoom reverting to 1 every time unity started up and was ran the first time. $$anonymous$$aybe they fixed that in the wrong way? Anyways, you should file a bug report on this, it's something that should stay at what you set it and default to 1 on the first run.
I am using unity 2017.1.p5, but since around unity 5.6 it was a similar phenomenon. In the first place, scale is touched. I want to turn off the SCALE function of the game view, I want to.
I am not sure if this is the issue or not, But sometimes when you have the game window set to Free Aspect Ratio you get an undesired effect. to fix click that button on your games window and a drop down will appear and show you options to set the screen size to a specific resolution size. where free Aspect will change the size of the canvas undesirably the others will scale to that aspect ratio. hope this helps.
Answer by Nick_D · Apr 04, 2018 at 07:59 AM
I experienced this bug and resolved it by pressing pause first, and then pressing the play button to run the game already paused. The first time you do that, the screen no long resizes automatically and will stick to what you've entered. After doing that once it no longer resets to the 2x default, even without pausing.
With version 2018.3.6 this did not work for me. The only fix I found was, to check the low resolution Aspect ratio in screen size, but then the resolution is wrong and the graphics all suck..
Answer by Valhalaru · Feb 04, 2019 at 07:06 PM
I had this happen for a long time. I wanted it in 0.6x, but it would jump to 1.0x every time I played it. I found that by setting it to the desired size, in my case 0.6x, and then closing Unity and reopening it, fixed the problem.
just tried this with 2018.3.6f1 -- it works :) thanks. Then after a day or so it stopped working :( back to looking for a solution.
Thanks, I close the unity when the game is running. Then it works! unity version 2018.4.0f1
Answer by hojjat-reyhane · Jun 19, 2019 at 02:24 AM
A fix to previous solution. In my case if I edit the scripts, unity 2019.1.5 changes the scale of game window. So ... Just add this to your project.
using System;
using System.Reflection;
using UnityEditor;
using UnityEngine;
using Object = UnityEngine.Object;
[InitializeOnLoad]
[ExecuteInEditMode]
public class FixGameWindowScaleBug
{
private static bool mUpdate = false;
static FixGameWindowScaleBug()
{
EditorApplication.update += update;
EditorApplication.delayCall += delayCall;
SetGameViewScale();
}
private static void delayCall()
{
mUpdate = true;
}
private static void update()
{
if (mUpdate)
{
SetGameViewScale();
mUpdate = false;
}
}
private static void SetGameViewScale()
{
Type gameViewType = GetGameViewType();
EditorWindow gameViewWindow = GetGameViewWindow(gameViewType);
if (gameViewWindow == null)
{
Debug.LogError("GameView is null!");
return;
}
var defScaleField = gameViewType.GetField("m_defaultScale", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
//whatever scale you want when you click on play
float defaultScale = 0.1f;
var areaField = gameViewType.GetField("m_ZoomArea", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
var areaObj = areaField.GetValue(gameViewWindow);
var scaleField = areaObj.GetType().GetField("m_Scale", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
scaleField.SetValue(areaObj, new Vector2(defaultScale, defaultScale));
}
private static Type GetGameViewType()
{
Assembly unityEditorAssembly = typeof(EditorWindow).Assembly;
Type gameViewType = unityEditorAssembly.GetType("UnityEditor.GameView");
return gameViewType;
}
private static EditorWindow GetGameViewWindow(Type gameViewType)
{
Object[] obj = Resources.FindObjectsOfTypeAll(gameViewType);
if (obj.Length > 0)
{
return obj[0] as EditorWindow;
}
return null;
}
}
Worked earlier, but now always gets "Gameview is null!" in Unity 2019.1.8
This fixed the problem for me. Thank you so much! The new scale pops in for a half second, and then your script puts it back to where I wanted it.
I'm using 2018.3.10f1 while working through a course on Udemy. I'll use updated versions on other projects, and maybe the problem will go away. But it's good for now. Thank again!
I fixed the code a bit
static FixGameWindowScaleBug()
{
EditorApplication.update += update;
}
private static void update()
{
EditorApplication.update -= update;
SetGameViewScale();
}
Answer by PNordlund · Feb 12, 2018 at 03:33 PM
I filed this bug long time ago but there was no will to investigate it. Happens to me pretty often.
https://fogbugz.unity3d.com/default.asp?905861_3oejdu3vvh5ig422
it's closed, so they must have looked at it. I can't see a response from your site to the last question either.
that's crazy they closed it. It happens to me about 20 times a day and is a large source of user frustration. (2016 Touch Bar 15" $$anonymous$$acBook Pro)
@$$anonymous$$ishaps Same device here and I'm getting this issue.
Answer by tylerwongj · Feb 02, 2019 at 11:59 PM
A few things have made the 2x go away for me:
1. Restart Unity
2. Change Build Settings - (I went from Android to the default PC, Mac, & Linux Standalone. At least do the development while in that build setting and then when finally exporting the .apk, change it to Android.)
None of the other solutions worked for me.
I followed your instruction, switched to PC and then back to Android. It worked... I believe if I simply closed and opened Game window, that should helped as well. I hope this will save someone from this bug (I spent two years with this bug and though that this is a feature)
Your answer
![](https://koobas.hobune.stream/wayback/20220612123307im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How can I create a grid for a Leveleditor? 1 Answer
Reuse Logger icons 0 Answers
Make a prefab with custom inspector into a dockable Window 0 Answers
Start/Stop Playmode from editor script 10 Answers
Unity 5 Lighting : Visual Guide In The Form Of A Diagram 0 Answers