Search Issue Tracker
By Design
Votes
0
Found in
2021.3.20f1
2022.2.10f1
2023.1.0b7
2023.2.0a5
Issue ID
UUM-29200
Regression
No
[UI Builder] Objects are pushed incorrectly inside visual element
How to reproduce:
1. Open the attached "repro_project.zip" project
2. Open UI/CauldronUI/CauldronMainUI.uxml
3. Observe "Recipe" button location inside the "Right" visual element
Note: (Recipe button's size and position are set from .buttonSmall USS class. They are set to Width: 70% and left absolute position of 15%)
Expected result: Button is in the middle of a visual element
Actual result: Button is pushed a bit to the left side of visual element
Reproducible with: 2021.3.20f1, 2022.2.10f1, 2023.1.0b7, 2023.2.0a5
!image-2023-03-06-18-38-18-266.png|width=253,height=307!
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
- Sprite Masks affect Sprite Renderers outside their range when a Light2D is present with specific Target Sorting Layers selected
- URP Lens Flare is rendered in the wrong position when Render Graph Compatibility Mode is enabled and Render Scaling is not 0
- Editor crashes on DrvPresentBuffers when loading RenderDoc while using OpenGLES 3.0 or OpenGLES 2.0 Graphics API
- [Test Runner] Incorrect name under Window > Panel after project restart
- [iOS] Crash when using fallback fonts created at runtime
Resolution Note:
Unity’s model is equivalent to setting the CSS box-sizing property to border-box (mentioned in the doc here: https://docs.unity3d.com/Manual/UIE-USS-SupportedProperties.html).
See this page for details https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing.
The button in the repro project has a margin, that's why it has a small offset. A preferred way to center elements would be to use a combination of `align-items`, `justify-content` or `align-self`.