Search Issue Tracker
By Design
Votes
0
Found in
2018.4
2020.1.2f1
2020.2
Issue ID
1270564
Regression
No
Borders appear in the Game view when the Display scaling is not 100% or 200% and the Game view Aspect is set to an aspect ratio
How to reproduce:
1. Open the Windows Display Settings (Right-click on an empty spot on the Desktop->Display settings)
2. In the Windows Display Settings scroll down and set the Scaling percentage to 125%
3. Create a new Unity project
4. Open the Game view
5. In the Game view set the Aspect ratio to "Free Aspect"
Expected results: Game view has no inner borders
Actual results: Game view gets inner borders
Reproducible with: 2018.4.26f1, 2019.4.9f1, 2020.1.4f1, 2020.2.0b1
Notes:
- Reproducible when the Display scaling is set to: 125%, 150%, 175%, 225%
- Does not reproduce when the Display scaling is set to: 100%, 200%
- Disabling the "Low Resolution Aspect Ratios" removes the borders
- The issue does not appear if the Aspect option is set to a Fixed Resolution and not Aspect Ratio
- The issue has been tested and reproduced on Windows
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Package Version Number Is Truncated When Package Manager List Width Is Maximized
- Unlocked Packages Become Locked After Closing and Reopening the Package Manager
- No minimum size on Search window
- Crash on Object::SetCachedScriptingObject when performing multiple Domain Reloads in a specific project
- All newly created color markers of Gradient Editor get removed at once when trying to remove one of them
Resolution Note:
It seems that the following method:
private float DefaultScaleForTargetInView(Vector2 targetToFit, Vector2 viewSize)
{
var scale = ScaleThatFitsTargetInView(targetToFit, viewSize);
if (scale > 1f)
{
scale = Mathf.Min(maxScale * EditorGUIUtility.pixelsPerPoint, Mathf.FloorToInt(scale));
}
return scale;
}
is explicitly using Mathf.FloorToInt(scale) to constraint the scale to start to 1x, 2x or so.
If this FloorToInt is removed the GameView behaves as expected. This FlootToInt prevents to start the scale at 1.25x for a 125% zoom for instance.
It is possible that the floor has been introduced to answer this kind of problem:
https://forum.unity.com/threads/editor-ui-needs-to-improve-and-support-high-dpi.527501/#post-3535290
So this behavior is by design.