Skip to content

Commit 2b623ad

Browse files
committed
Make sure scene references are still maintained for Transforms
1 parent d122f3f commit 2b623ad

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

com.unity.formats.fbx/Editor/ConvertToNestedPrefab.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -868,22 +868,21 @@ internal static void CopyComponents(GameObject to, GameObject from, GameObject r
868868
continue;
869869
}
870870

871-
// ignore MeshFilter, but still ensure scene references are maintained
872-
if (fromComponent is MeshFilter)
871+
// ignore MeshFilter and Transform, but still ensure scene references are maintained.
872+
// Don't need to copy regular transform as the values should already be correct in the FBX.
873+
// Furthermore, copying transform values may result in overrides in the prefab, which is undesired as if
874+
// the transform is updated in the FBX, it won't be in the prefab.
875+
if (fromComponent is MeshFilter || fromComponent is Transform)
873876
{
874-
FixSceneReferences(fromComponent, to.GetComponent<MeshFilter>(), root);
877+
FixSceneReferences(fromComponent, to.GetComponent(fromComponent.GetType()), root);
875878
continue;
876879
}
877880

878881
// ignore FbxPrefab (when converting LinkedPrefabs)
879882
// Also ignore RectTransform, since it is not currently possible to switch transforms
880883
// in a prefab.
881-
// Don't need to copy regular transform either as the values should already be correct in the FBX.
882-
// Furthermore, copying transform values may result in overrides in the prefab, which is undesired as if
883-
// the transform is updated in the FBX, it won't be in the prefab.
884884
if (fromComponent is UnityEngine.Formats.Fbx.Exporter.FbxPrefab ||
885-
fromComponent is RectTransform ||
886-
fromComponent is Transform)
885+
fromComponent is RectTransform)
887886
{
888887
continue;
889888
}

0 commit comments

Comments
 (0)