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
12
Found in
5.3.2p1
Issue ID
768959
Regression
No
Wrong default value for array elements added in inspector
When increasing the size of an array (of class) in the inspector, the constructor for the array member is called, but then the value is deserialised (not sure from where) causing all the fields to go to zero.
Reproducible on 5.2, 5.3, 5.4
This is discussed in several threads, for example:
http://answers.unity3d.com/questions/600150/initialization-of-classes-instatiated-in-an-array.html
Repro steps:
1) Open attached project "39037.zip"
2) Open "main" scene
3) On the ScriptHolder object increase the size of "My Array" from 1 to 2
4) Observe the new element has defaulted values of 0,0 instead of the expected 1,2
---
Postponed:
Fixing this requires us to change the way array elements are initialized and call ctors on them in the editor.
The risk with this issue is that we would be calling code in the ctors that we have never called before and this could cause unwanted side-effects in user projects. Fixing this issue is going to create potentially much more issues. Postponing to improve this behaviour in the future.
Comments (5)
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
- var VisionOSEDRHeadromm has a comma instead of a dot when building with Metal Rendering App Mode and local OS localization is set to German
- IAP Catalog remove product “x” and add product “+” buttons are not consistent with other remove and add buttons in the Editor
- Performance issues in Play Mode when quickly hovering the mouse cursor over Hierarchy GameObjects
- Frame Debugger displays incorrect output when FidelityFX Super Resolution or Spatial-Temporal Upscaler is used with Temporal Anti-aliasing or Subpixel Morphological Anti-aliasing
- The layout system is failing to correctly calculate or apply the height of the Japanese fallback font when the primary English font's metrics are used
mangusupixel
Oct 09, 2025 18:07
Still an issue 9 years later. Very annoying.
Crayden
Apr 26, 2022 17:17
Instead of doing CTOR changes, can you guys maybe create a custom attribute [SerializeFieldListDefaultValue]?
Crayden
Apr 26, 2022 17:14
This issue is causing such troubles in my workflow.. :(
DearUnityPleaseAddSerializableDictionaries
Sep 01, 2021 23:32
Hacky workaround that works: https://forum.unity.com/threads/default-values-for-serializable-class-not-supported.42499/#post-7445180
DearUnityPleaseAddSerializableDictionaries
Sep 01, 2021 23:06
+1 Personally, this is the most negatively impacting issue/experience for me in Unity 3D (on par with one other issue).