Search Issue Tracker
Fixed
Fixed in 2022.3.6f1, 2023.1.5f1, 2023.2.0b3, 2023.3.0a1
Votes
0
Found in
2022.2.0a3
2022.2.0b15
2023.1.0a19
2023.2.0a1
2023.3.0a1
Issue ID
UUM-19254
Regression
Yes
[UI Builder] VisualElement has set flex-grow and background-color default inline styles when created in UI Builder
How to reproduce:
1. Create a new Unity project
2. Got to Window >UI Toolkit > UI Builder
3. Add a VisualElement container to the Viewport
4. In the Inspector > Inlined Styles > Flex observe the Grow value
Expected result: flex-grow value is equal to 0
Actual result: flex-grow value is equal to 1
Reproducible with: 2022.2.0a3, 2022.2.0b15, 2023.1.0a19
Not reproducible with: 1.0.0-preview.18 (2020.3.42f1), 2021.3.14f1, 2022.1.23f1, 2022.2.0a2
Note: Background color is also made transparent by default
-
vallis_unity
Nov 25, 2022 13:18
I strongly disagree with this reasoning. These style overrides are inline and so override everything in both the default stylesheets and ALL user stylesheets. It's extremely easy to miss these inline styles on a VisualElement in the builder when putting together a complex nested hierarchy of objects.
Surely if you want these styles to be the default for all VisualElements then that should be set in the unity stylesheets so that they can be overriden at a project level when required, not set inline on each object.
I'm currently dealing with this by searching all uxml files in my project for style attributes regularly because despite being painfully aware what is happening it's all to east to forget to unset all on a new element while authoring new UI.
I hope you will reconsider the approach taken here.
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
- [iOS] Back Triple Camera is not focusing manually and automatically
- Mouse inputs cannot be inputted when searching the Shortcuts Menu by type "Shortcut"
- "Debug Assertion Failed!" error when launching Windows Dedicated Server Player with Script Debugging enabled
- [Cinematic Studio][3D HDRP] Shader warnings thrown in the Console window when creating a new project with Cinematic Studio template
- Autoplay is triggered on Audio Assets when changing Asset Bundle tags
Resolution Note (fix version 2023.3.0a1):
Fixed UUM-19254 @laila-chammaa:
UI Toolkit: Added an option to the library's settings that will allow the user to use a blank VisualElement by default when adding from the library.
Resolution Note (fix version 2023.2.0b3):
Fixed UUM-19254 @laila-chammaa:
UI Toolkit: Added an option to the library's settings that will allow the user to use a blank VisualElement by default when adding from the library.