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
- Texture displays visual artifacts and has a broken aspect ratio when it is imported in RGB 48-bit format
- Diagnostic Warning Resets When Navigating Away and Returning to Diagnostics Settings
- Checkbox Collides with Text in Shader Graph Preferences Settings
- Crash on mecanim::animation::TransformValuesFromClip when entering the Play Mode in a project with Animancer Pro v8
- Connection to Named Pipes fails when server and client are run
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.