Search Issue Tracker
By Design
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
- Prefab Override popup displays on wrong monitor when Inspector width is resized to minimum
- Scroll View is not moving by inertia after scrolling by click and dragging when Editor window is minimized and Canvas "Render Mode" is set to "World Space"
- "type mismatch error" occurs when the currentDirectionWS output of a Sample Water Surface node is connected to a float3 input
- URP Material Upgrade utility does not enable Alpha Clipping when material had Rendering Mode set to Cutout
- Particle System emission ignores the Sprite Atlas when using a Material that has the "Include in Build" setting unchecked
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