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
- Rigidbody2D.Slide API does not have the needed configuration when creating a 2D Top-Down character controller
- Opening reference for "Playables"component redirects to a missing page
- Sprite Renderer image is changed when switching Mask Interaction and changing Sprite to a shared Sprite
- An unsigned integer is not compared with an integer correctly in player when using IL2CPP backend
- Graphical artifacts are being rendered in Scenes that are loaded during run-time when GPU Resident Drawer is turned on
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).