Search Issue Tracker
Fixed in 2020.2.X
Votes
0
Found in
2018.3.5f1
Issue ID
1127313
Regression
No
PrefabUtility.SaveAsPrefabAsset() freezes the editor when called from OnValidate() method
To reproduce:
1. Open any project
2. Import the script attached "CreatePrefab.cs" (or make your own: call PrefabUtility.SaveAsPrefabAsset() from method OnValidate())
3. Assign the script to a game object and pick a game object for the script's public field (ex.: freshly created 3d object)
Result: editor freezes on trying to validate script after changes have been made
Reproduced in: 2018.3.7f1, 2019.1.0b5, 2019.2.0a6
Note1: OnValidate() can also be checked by commenting out PrefabUtility.SaveAsPrefabAsset(), adding GameObject to script's public field and decommenting. OnValidate
will once again freeze the editor.
Note2: PrefabUtility not available on LTS
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
- “[Worker0] Could not generate preview image“ error when opening macOS native plugin in the Inspector with Architecture to build for set to ARM 64-bit
- [iOS] Application.absoluteURL is empty on Awake/Start when opening via deep link with Splash Screen disabled
- Crash on MemoryManager::Deallocate when rapidly calling Addressables.LoadAssetAsync
- Crash on physx::shdfnd::atomicIncrement when adjusting values on a character controller component after entering Play mode in Prefab edit mode
- [Rendering Debugger] [NewInputSystem] Debug Overlays in Play mode throws InvalidOperationException when using New Input System
Resolution Note (fix version 2020.2):
Saving a prefab during OnValidate, physics trigger/contact, animation event callbacks, rendering callbacks is not allowed and is now handled and an error message is logged in the console.