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
- Search field in UI Builder's Library has no character limit
- Changing the value in UI Builder by dragging increases it by a few thousand points when reaching the borders of the screen
- ARM64 architecture DLL incorrectly copied instead of x64 when building for Windows x64
- Crash on TypeTreeIterator::GetNode when opening a specific folder
- Crash on WriteSerializedAssetsV2 when (re)entering the Play Mode in a specific project when IEnumerator Start() is used
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).