Skip to content

Commit 4eb8633

Browse files
authored
Merge pull request #170 from Unity-Technologies/UNI-27028-error-adding-vfx-component
Uni 27028 error adding vfx component
2 parents 7994864 + 231c0e5 commit 4eb8633

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Assets/FbxExporters/Editor/ConvertToModel.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,10 @@ public static void CopyComponents(GameObject from, GameObject to){
400400
}
401401

402402
var json = EditorJsonUtility.ToJson(component);
403+
if (string.IsNullOrEmpty (json)) {
404+
// this happens for missing scripts
405+
continue;
406+
}
403407

404408
System.Type expectedType = component.GetType();
405409
Component toComponent = null;
@@ -418,7 +422,9 @@ public static void CopyComponents(GameObject from, GameObject to){
418422
if (!toComponent) {
419423
// It doesn't exist => create and copy.
420424
toComponent = to.AddComponent(component.GetType());
421-
EditorJsonUtility.FromJsonOverwrite(json, toComponent);
425+
if (toComponent) {
426+
EditorJsonUtility.FromJsonOverwrite (json, toComponent);
427+
}
422428
} else {
423429
// It exists => copy.
424430
// But we want to override that behaviour in a few

0 commit comments

Comments
 (0)