Search Issue Tracker
By Design
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
- Crash on operator delete[] when Instantiating an Asset Bundle that references an another Asset Bundle with a MonoBehaviour
- Background Thread crash freezes editor when opening a specific scene
- Editor Menus text doesn’t update when Switching Editor language back to English
- "Atlas uncompressed. This can be caused by mismatch texture formats." is thrown when Paint Details is selected
- [Linux] Crash on g_type_check_instance_cast when creating a project
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.