Search Issue Tracker
By Design
Under Consideration for 2021.3.X, 2022.3.X, 2023.2.X, 2023.3.X
Votes
0
Found in
2021.3.33f1
2022.3.14f1
2023.2.2f1
2023.3.0a16
Issue ID
UUM-57223
Regression
No
List items wrongly initialized in the Inspector when values are declared in the constructor
How to reproduce:
1. Open the attached project "90_develop.zip"
2. Select "Test" in the Inspector window
3. Add a new Element to the "Items" list in the Inspector window
Expected results: "Var 1" and Var 2" are set to "10" and "20"
Actual results: "Var 1" and Var 2" are both set to "0"
Reproducible with: 2021.3.33f1, 2022.3.14f1, 2023.2.2f1, 2023.3.0a16
Reproducible on: Windows 11 22H2
Not reproducible on: No other environment tested
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
- Mono Windows Builds don't produce full log callstacks when generating logs
- AssetBundles fail to load when running in Built Players for Mobile Devices
- UI elements with text gets bigger and grey when Player window is moved to another screen with different resolution
- System name accepts multiline text but crops it on confirmation, duplicates input, and shrinks the field when empty
- UI element scale and position are wrong in project build when DRS is changed with HDR and Software Dynamic Resolution enabled
Resolution Note:
Thank you for reporting a bug to Unity.
When the first element is added to an array via SerializedProperty it is allocated by zeroing the memory rather than calling the constructor. And when adding additional elements it copies the previous element. We will consider changing that behavior as part of future quality improvement work in the area of SerializedObject/SerializedProperty but also wary of any possible performance and backward compatibility impact for changing this behaviour.
Today we will be closing this case. Thank you again for taking the time to report this issue