Search Issue Tracker
By Design
Votes
0
Found in
4.5.3f3
Issue ID
627125
Regression
No
Adding new (not mb) list elements in the inspector overwrites the object's default field values set in the constructor
To Reproduce:
1. Open the attached project or paste the attached script into a new file.
2. Change 'Test List' size to any value observe that the Constructor of 'Data' is called, but the new list element has it 'Vector3' field set to (0,0,0) instead of 'Vector3.One'
There is also another issue, when changing the list.size property in inspector to many (equal to size value) objects are constructed ,but the number of objects which are actually used seems to be equal the difference between the new & the old size values.
For example:
1. Change list size from 0 to 1.
2. Edit the first element, change size to 2
3. Notice that the constructor is called twice, even if only one additional element is added, also the new element is a duplicate of the first one
Comments (1)
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
- “Label” name in Sprite Library Editor window lacks character limit causing long names go under the Object Field
- Preview image (screenshot) is not available after capturing snapshot in Memory Profiler
- Crash on UNITY_FT_Stream_ReadAt when changing TMPro properties after unloading an AssetBundle
- Particles spawn at the same position when using raw byte address buffer in VFX Graph
- Decal Shader Graph - Custom vertex interpolators are always 0
Sycobob
Nov 29, 2015 23:51
Even if this is by design, it's a pretty big problem. There's no way for me to give designers sensible default values if I expose data to them in a collection.
Further, it means there's inconsistent behavior. Field initializers and constructors work on single fields but don't work on collections. That means I can't rely on field initializers working at all if I can't guarantee the type won't be used in a collection.
For the sake of usability, I'd like to request altering the design.