Search Issue Tracker
By Design
By Design in 2017.1.X
Votes
12
Found in
2017.1.1p2
Issue ID
956330
Regression
No
Undo.RecordObject fails to properly record new list elements if the object is a prefab instance
How to reproduce:
1. Download attached project file
2. Create a new GameObject and add an "AnimationPlayer" script to it.
3. Turn this new GameObject into a prefab by dragging it into the assets view.
4. Select Prefab in Hierarchy window and press the "Add 2D Blend Tree" button in Inspector (Important! Don't apply changes after adding the 2D blend tree.)
5. Enter Play Mode
Actual result: When a MonoBehaviour is an instance of a Prefab, Undo.RecordObject fails to properly record some details when adding objects to a list, causing data to be lost when entering Play Mode or leaving the scene. The same changes will be applied properly if the MonoBehaviour is not a part of a prefab.
In technical detail; if the MonoBehaviour is a Prefab, an addition to a List<Foo> where Foo is a serializable class causes the prefab override to store the new List size, but no information about the new element.
Reproduced with: 2017.1.2f1, 2017.2.0f3, 2017.3.0b3
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
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
MorCompediaNet
Dec 12, 2017 18:31
Just adding in that this is true not only for lists of custom types, but also lists of strings and primitives.
Also, arrays don't work either, it seems to be a problem with generic collections.