Skip to content

Commit ca0446c

Browse files
authored
Merge pull request #186 from Unity-Technologies/UNI-29157-fix-component-update-fail
UNI-29157 add null check for component before copying to it
2 parents 10d680a + 294feaa commit ca0446c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Assets/FbxExporters/Editor/FbxPrefabAutoUpdater.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,15 @@ public HashSet<GameObject> ImplementUpdates(FbxPrefab prefabInstance)
989989
prefabComponent = prefabXfo.gameObject.AddComponent(fbxComponent.t);
990990
Log("created component {0}:{1}", nodeName, fbxComponent.t);
991991
}
992-
992+
// Check that the component exists before copying to it.
993+
// This happens for Rect Transform components as the fbx
994+
// contains a Transform which it tries to add/update on the
995+
// prefab, but fails because you cannot have both a Transform
996+
// and a Rect Transform
997+
// UNI-29179 TODO: better handling of Rect Transforms
998+
if (!prefabComponent) {
999+
continue;
1000+
}
9931001
// Now set the values.
9941002
UnityEditor.EditorJsonUtility.FromJsonOverwrite(fbxComponent.jsonValue, prefabComponent);
9951003
}

0 commit comments

Comments
 (0)