Search Issue Tracker
By Design
By Design in 2023.2.X
Votes
0
Found in
2020.3.48f1
2021.3.26f1
2022.2.21f1
2023.1.0b17
2023.2.0a16
Issue ID
UUM-36749
Regression
No
The Prefab variant removes some of the prefab items from the list when changing the base Prefab
Reproduction steps:
1. Open the attached “Test Project” project
2. Open the “Scenes/SampleScene” Scene
3. Select the “Collection Variant” GO in the Hierarchy window
4. Replace “Element 1” Prefab with “ObjectB-1” Prefab and “Element 3” Prefab with “ObjectD-1” Prefab under “Game Object List (Script)” Component
5. Press “Apply as Override in Prefab ‘Collection Variant’”
6. Select the “Collection” GO in the Hierarchy window
7. Add a new list element with “ObjectF” Prefab attached under “Game Object List (Script)” Component
8. Press “Apply to Prefab ‘Collection’”
9. Drag “Element 5” to the 2nd position (below “Element 0”)
10. Observe “Collection Variant” in the Inspector window
Expected result: The list under the “Game Object List” Component is moved the same way as in the “Collection” GO list
Actual result: The list under the “Game Object List” Component loses references to “ObjectF” and “ObjectC” Prefabs
Reproducible with: 2020.3.48f1, 2021.3.26f1, 2022.2.21f1, 2023.1.0b17, 2023.2.0a16
Reproducible on: Windows 10
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
- VFX Graph Documentation dropdown button does nothing when clicked on the right side
- Required SpriteMask class (ID 331) is stripped when "Strip Engine Code" is enabled
- “Maximized serialized file backup not found” error is thrown when minimizing a window in a newly opened project
- Build stack trace contains invalid lines when building with IL2CPP using scripts with delegates containing generic types in the signature
- Entities Systems window has a “Show Full Player Loop” dropdown which does nothing when clicked after enabling “Show Full Player Loop”
Resolution Note:
Hi, this behavior is by design and I'll try to explain why you see the reported behavior.
It comes down to how Unity stores overrides on a Prefab instance.
A variant is just a Prefab instance with some overrides that is stored on disk, as such it matches the behavior of a Prefab instance in a scene.
Following the reproduction steps in the sample project, when the array at index 1 and 3 is overriden and the values is set to B-1 and D-1 respectively, and then applied to the Variant, the Variant file now looks like this:
1: %YAML 1.1
2: %TAG !u! tag:unity3d.com,2011:
3: --- !u!1001 &340841945601867302
4: PrefabInstance:
5: m_ObjectHideFlags: 0
6: serializedVersion: 2
7: m_Modification:
8: serializedVersion: 3
9: m_TransformParent: {fileID: 0}
10: m_Modifications:
11: - target: {fileID: 1271886037943160647, guid: d5e33f7acd4b3b64aa59937296dbd542, type: 3}
12: propertyPath: m_Name
13: value: Collection Variant
14: objectReference: {fileID: 0}
15: - target: {fileID: 5603053799742353142, guid: d5e33f7acd4b3b64aa59937296dbd542, type: 3}
16: propertyPath: '_list.Array.data[1]' <<------------
17: value:
18: objectReference: {fileID: 2962250130845081245, guid: f92070e74886a9546982d19648effe58, type: 3}
19: - target: {fileID: 5603053799742353142, guid: d5e33f7acd4b3b64aa59937296dbd542, type: 3}
20: propertyPath: '_list.Array.data[3]' <<------------
21: value:
22: objectReference: {fileID: 6738187195160407072, guid: dd79403a8d3ccd345add6b59dd590cf1, type: 3}
Notice how on line 16 and 20 there is an override for the specific position in the array, so when the array in the Parent Prefab is modified the values, the Variant will keep overriding whatever value is a index 1 and 3.
This is fundamental to how Unity store overrides for arrays and affects all projects.
I hope this helps.
Resolution Note (2023.2.X):
Hi, this behavior is by design and I'll try to explain why you see the reported behavior.
It comes down to how Unity stores overrides on a Prefab instance.
A variant is just a Prefab instance with some overrides that is stored on disk, as such it matches the behavior of a Prefab instance in a scene.
Following the reproduction steps in the sample project, when the array at index 1 and 3 is overriden and the values is set to B-1 and D-1 respectively, and then applied to the Variant, the Variant file now looks like this:
1: %YAML 1.1
2: %TAG !u! tag:unity3d.com,2011:
3: --- !u!1001 &340841945601867302
4: PrefabInstance:
5: m_ObjectHideFlags: 0
6: serializedVersion: 2
7: m_Modification:
8: serializedVersion: 3
9: m_TransformParent: {fileID: 0}
10: m_Modifications:
11: - target: {fileID: 1271886037943160647, guid: d5e33f7acd4b3b64aa59937296dbd542, type: 3}
12: propertyPath: m_Name
13: value: Collection Variant
14: objectReference: {fileID: 0}
15: - target: {fileID: 5603053799742353142, guid: d5e33f7acd4b3b64aa59937296dbd542, type: 3}
16: propertyPath: '_list.Array.data[1]' <<------------
17: value:
18: objectReference: {fileID: 2962250130845081245, guid: f92070e74886a9546982d19648effe58, type: 3}
19: - target: {fileID: 5603053799742353142, guid: d5e33f7acd4b3b64aa59937296dbd542, type: 3}
20: propertyPath: '_list.Array.data[3]' <<------------
21: value:
22: objectReference: {fileID: 6738187195160407072, guid: dd79403a8d3ccd345add6b59dd590cf1, type: 3}
Notice how on line 16 and 20 there is an override for the specific position in the array, so when the array in the Parent Prefab is modified the values, the Variant will keep overriding whatever value is a index 1 and 3.
This is fundamental to how Unity store overrides for arrays and affects all projects.
I hope this helps.