Skip to content

Commit 20ea9bd

Browse files
committed
auto connect when creating prefab
instead of creating the prefab and connecting afterwards, which causes a Unity crash
1 parent 62ea717 commit 20ea9bd

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

Assets/FbxExporters/Editor/ConvertToModel.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,16 +206,13 @@ public static GameObject Convert (
206206

207207
// Create a prefab from the instantiated and componentized unityGO.
208208
var prefabFileName = Path.ChangeExtension(projectRelativePath, ".prefab");
209-
var prefab = PrefabUtility.CreatePrefab(prefabFileName, unityGO);
209+
var prefab = PrefabUtility.CreatePrefab(prefabFileName, unityGO, ReplacePrefabOptions.ConnectToPrefab);
210210
if (!prefab) {
211211
throw new System.Exception(
212212
string.Format("Failed to create prefab asset in [{0}] from fbx [{1}]",
213213
prefabFileName, fbxFullPath));
214214
}
215215

216-
// Connect to the prefab file.
217-
unityGO = PrefabUtility.ConnectGameObjectToPrefab(unityGO, prefab);
218-
219216
// Remove (now redundant) gameobject
220217
bool actuallyKeepOriginal;
221218
switch(keepOriginal) {

0 commit comments

Comments
 (0)