Search Issue Tracker
By Design
By Design in 2022.2.X
Votes
4
Found in
2020.3.33f1
2021.3.1f1
2022.1.0f1
2022.2.0a11
Issue ID
UUM-3475
Regression
Yes
[UI Toolkit] Input Fields created with "PropertyField" and "TextField" have different widths when changing the Inspector window
How to reproduce:
1. Open project "BugReport.zip"
2. Open the "Scene" Scene (Assets > Scene)
3. In the Hierarchy window select the "MyComponent" GameObject
4. Keep changing the Inspector window width
Expected result: Both Input Fields are the same width
Actual result: Both Input Fields have different width
Reproducible with: 1.0.0-preview.17, 1.0.0-preview.18 (2020.3.33f1), 1.0.0 (2021.3.1f1, 2022.1.0f1, 2022.2.0a11)
Not reproducible with: 1.0.0-preview.16 (2020.3.33f1)
Could not test with: 2019.4.38f1 (No UI Toolkit package)
Comments (2)
-
karl_jones
Sep 19, 2023 10:38
The property field adds a class to its child elements, this class is what causes them to be aligned.
For example:
`field2.AddToClassList(BaseField<string>.alignedFieldUssClassName);`We will look into improving our documentation to make this more clear.
-
Catsoft-Works
Jun 24, 2022 10:06
That makes no sense.
PropertyFields create specific type fields (FloatField, TextField, etc...) as child UIToolkit elements. If creating a PropertyField, generates a FloatField that has a different width value than directly creating a FloatField, how can we expect to make consistent interfaces?
So instead of fixing PropertyFields width, you propose we change ALL other specific fields and add the class .unity-base-field__aligned?
I'd urge to review this ticket.
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
- Uninitialized variable warning appears in the Inspector of a custom shader when the variable is initialized
- "Failed creating toolbar element from ID..." error is thrown when resetting the Scene view Overlay layout while an Asset Transformer Toolbox overlay is active
- Entity ID for Font Assets is serialized twice which throws an error when using Debug Inspector
- Play Mode can be entered when disabling Adaptive Performance and pressing either the Play Mode button or the keyboard shortcut to enter Play Mode before recompilation leading to errors and warnings thrown
- Parent ListView element also becomes selected when inner ListView element is selected
Resolution Note:
Adding the `alignedFieldUssClassName` class to the field element will enable the same alignment as a PropertyField.
https://docs.unity3d.com/ScriptReference/UIElements.BaseField_1-alignedFieldUssClassName.html
We will seek to improve the documentation to make this clearer.
Resolution Note (2022.2.X):
Adding the `alignedFieldUssClassName` class to the field element will enable the same alignment as a PropertyField.
https://docs.unity3d.com/ScriptReference/UIElements.BaseField_1-alignedFieldUssClassName.html
We will seek to improve the documentation to make this clearer.