Search Issue Tracker
By Design
Votes
0
Found in
2018.3.0a6
2018.3.0f2
2019.1.0a1
2019.2.0a1
Issue ID
1114273
Regression
No
ArgumentException is thrown when trying to create a Prefab out of a imported model asset using PrefabUtility.SaveAsPrefabAsset()
Reproduction steps:
1. Open the project from "CreatePrefabFromModelBug.zip"
2. Right click on the "Model" asset inside Project window and click -> Reimport
Expected: New prefab is created from the reimported model
Actual: "ArgumentException: Can't save persistent object as a Prefab asset" is thrown and logged in the console
Reproduces on: 2018.3.6f1, 2019.1.0b3, 2019.2.0a5
Note:
PrefabUtility.SaveAsPrefabAsset was introduced in 2018.3.0a6
Comments (2)
-
Airmouse
Mar 23, 2019 06:00
Turns out it was because I was trying to save the .fbx directly as a prefab. Instead I needed to first instantiate it, then I could save it:
var SceneObject = Instantiate(modelAsset);
PrefabUtility.SaveAsPrefabAsset (SceneObject, destinationPath);
DestroyImmediate (SceneObject); -
Airmouse
Mar 23, 2019 05:40
Same in 2019, break Unity automation and is makeing gamebuilding a time consuming nightmare.
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
- Errors are logged when importing an asset at a path with Firebase
- Entering too big of a number in 2D Renderer Lightmode Tags freezes the Editor
- Crash on GUIManager::DoGUIEvent when focusing on the Game view window on a specific project
- Asset creation in the Project Browser is not always undone/inconsistent when the undo shortcut is pressed right after creating an asset
- JobTempAlloc memory leak warning is thrown when the Player is shut down
Resolution Note:
The creation of the prefab out of the model in postprocessor requires a little bit more code: You need to instantiate your model first, then save as prefab asset and destroy the instance.