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
- Too little validation messages in the "WebAssembly Language Features" Memory settings
- Project Settings Search Highlights are misaligned when using the Bitmap Text Rendering Mode
- "GetControlID at event ValidateCommand returns a controlID different from the one in Layout event" Warning is thrown when undoing the deletion of Sprite Shape Profile
- Memory related fields in the "WebAssembly Language Features" can be set to the negative numbers
- "WebAssembly Language Features" Header in the Player Settings has a smaller indentation
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.