Search Issue Tracker
By Design
By Design in 2023.1.X
Votes
0
Found in
2020.3.37f1
2021.3.6f1
2022.1.10f1
2022.2.0b1
2023.1.0a3
Issue ID
UUM-9211
Regression
No
VisualElements are scaled inconsistently when using "Scale With Screen Size" and the rendered resolution is not a multiple of "Reference Resolution"
Reproduction steps:
1. Open the attached “UIScaling“ project
2. Open the “SampleScene” scene
3. In the Game window, select the “WXGA (1366x768)” aspect
4. Observe the 6 rectangles in the center of the Game view
Expected result: All rectangles are equal squares
Actual result: Some rectangles are wider than the others (e.g. 2nd and 5th)
Reproduced with: 1.0.0-preview.18 (2020.3.37f1), 2021.3.6f1, 2022.1.10f1, 2022.2.0b1, 2023.1.0a3
Reproduced on: Windows 10/11
Note: Also reproduced in builds
Comments (1)
-
ChristianTeister
Aug 01, 2022 09:00
How is one supposed to create scalables UI where elements don't have a random size offset then?
There is no reference resolution that scales without issues:
If the reference is 1280x720, then it looks messed up on 1920x1080, 2560x1600, 1600x900 1440x900, 1366x768, ...
If the reference is 1920x1080, then it looks messed up on 2560x1440, 3440x1440, 2560x1600, 1366x768, 1280x720This is a horrible design decision.
Using "constant pixel size mode" also doesn't change the pixel grid snapping, so it doesn't help at all.
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
- "Shader warning in 'Hidden/Light2D': implicit truncation of vector type" is thrown when building Universal 2D template
- AI Assistant breaks compilation of packages using System.Runtime.CompilerServices.Unsafe via auto-referencing
- Unity Hub checks the "Documentation" module by default on the 6.4 and 6.5 streams despite that it was unchecked with the previous installs
- Shortcut that toggles between Dopesheet and Curves Views in the Animation Window's Timeline is mislabed
- Property List Items Overlap onto the Property List's top edge when scrolling through a long Property List
Resolution Note:
UIToolkit layout engine will always align element boundaries to the pixel grid in order to avoid antialiasing artifacts on edges.
When combined with non-integer scaling factors this can happen. If that behavior is not compatible with your needs, you can use the constant pixel size mode and assign an integer scaling factor to the PanelSettings object.
See https://docs.unity3d.com/2021.2/Documentation/ScriptReference/UIElements.PanelSettings-scale.html
Resolution Note (2023.1.X):
UIToolkit layout engine will always align element boundaries to the pixel grid in order to avoid antialiasing artifacts on edges.
When combined with non-integer scaling factors this can happen. If that behavior is not compatible with your needs, you can use the constant pixel size mode and assign an integer scaling factor to the PanelSettings object.
See https://docs.unity3d.com/2021.2/Documentation/ScriptReference/UIElements.PanelSettings-scale.html