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
- Animator state transition preview clips are flickering when zooming in
- [Tile Palette] Sprites not rendering when brush tool "Paint a filled box with active brush" is used for the first time
- Adding available Nodes with longer names in Fragment Context window overflow Fragment Context window in Shader Graph
- "Layer Palette Profile" Asset is automatically applied to the second Terrain but doesn't load any layers
- "Terrain Tools" shortcut conflicts with the Overlays shortcut by default
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