Search Issue Tracker
By Design
Votes
0
Found in
2018.3.0f2
Issue ID
1122921
Regression
No
Object reference is lost when using PrefabUtility.SaveAsPrefabAssetAndConnect in Play mode
To reproduce:
1. Open the project attached "616073-201830f2-prefab-save.zip", scve
2. In Hierarcy window, sleect GameObject
3. In Inspector window, drag "Main Camera" to Obj property field in Test Prefab Component, apply prefab override
4. Enter Play mode, modify the value of 'Age' and click SaveAsPrefabAssetAndConnect
5. Exit Play mode and check Obj property of GameObject
Expected: prefab reference remains referenced in the property field
Actual: property field is empty (reference lost)
Reproduced in: 2018.3.7f1, 2019.1.0b6, 2019.2.0a7
Note: 2019.2.0a7 throws error when executing:
Save prefab failed.
UnityEngine.Debug:LogError(Object)
TestPrefabInspector:OnInspectorGUI() (at Assets/TestPrefabInspector.cs:25)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
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
- Color property '_BaseColor' missing
- Point Light source stops lighting when moved out of camera frustum in Player while having 2 directional lights in scene present, and a fog enabled by script
- Sky does not get rendered when 'CameraRelativeRendering' is disabled
- Dropdown UI elements have their Content misplaced when nested inside a Prefab containing a root object with a Canvas Component
- “'UnityMetaVertexPosition': implicit truncation of vector type" Shader warning when compilating URP ShaderGraph shaders
Resolution Note (2019.2.X):
This is by design. A Prefab asset cannot save references to Scene objects but it is valid for an Prefab instance to have a reference to other Scene objects. Note that the blue line in the Inspector stays even after Apply All has been executed (it is still marked as as an override since the value could not be saved to the Prefab).