Skip to content

Commit cd36a8f

Browse files
authored
Merge pull request #181 from Unity-Technologies/UNI-28475-converting-UI-crashes-Unity
UNI-28475 auto connect when creating prefab
2 parents 5b1e732 + 20ea9bd commit cd36a8f

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)