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
- Texture is stored upside down when using Blit
- [VFX] Missing Expand Toggle with Output Slot
- [OpenGLES][XR] Zooming in on the camera's URP opaque texture causes "double vision" on Quest in OpenGLES3
- “[Worker0] Could not generate preview image“ error when opening macOS native plugin in the Inspector with Architecture to build for set to ARM 64-bit
- [iOS] Application.absoluteURL is empty on Awake/Start when opening via deep link with Splash Screen disabled
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