Search Issue Tracker
Postponed means that the issue was either a feature request or something that requires major refactoring on our side. Since that makes the issue not actionable in the close future we choose to close it as Postponed and add it on our internal roadmaps and technical debt pages instead.
Postponed
Votes
24
Found in
3.5.0f1
2018.4
2019.3
2020.1
2020.2
Issue ID
442732
Regression
No
SerializeField list objects are not initialized with class/struct default values when adding objects in the Inspector window
How to reproduce:
1. Open the attached 'project-442732.zip' project
2. In the Hierarchy window select 'Test'
3. In the Inspector window set the 'Test Data' array size to 1
Expected result: new TestData object is initialized with its default values (someFloat = 30f, someBool = true, someInt = 10)
Actual result: new TestData object is initialized with default variable type values (someFloat = 0f, someBool = false, someInt = 0)
Reproducible with: 2018.4.23f1, 2019.3.15f1, 2020.1.0b10, 2020.2.0a12
Comments (6)
-
a-symington
Nov 17, 2025 06:36
Due to this ticket being "Postponed" they probably aren't seeing comments on this, and votes might be wasted. But still...
I can see how it might be a major refactor to fix, but it's also a major defect in a very core Unity feature because adding a new field to a serialized array in larger projects and then having to potentially check/manually override many instances because the default isn't being respected is very time-consuming and error-prone. (And this is if you even understand what happened in the first place...)
-
SoapsudsMelon
Sep 27, 2025 17:00
Still present in 2022.3.61f1 as well.
-
Waz
Sep 15, 2025 05:54
It's basically violating C# invariants, so there's not even the concern that it would "break existing code" - the default C# behaviour is zeroed memory, so only someone who has deliberately added a default constructor will see a change,
-
inflict98
Aug 07, 2025 15:30
Any update on this ? :')
-
Kogamma
Feb 21, 2023 09:57
Yeah, this is really strange behaviour, would be very good to fix this
-
AtsusaKai
Apr 21, 2022 13:33
10+ years have passed... Any chance this issue gets resolved?
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:
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.