Skip to content

Commit 2ed9af8

Browse files
committed
handle copying a skinned mesh component
If we are copying the values for a skinned mesh, then make sure that everything but the shared mesh gets copied over, otherwise we will have the old shared mesh
1 parent 8c3e95b commit 2ed9af8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Assets/FbxExporters/Editor/ConvertToModel.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,14 @@ private static void CopyComponents(GameObject from, GameObject to){
171171
// don't want to copy MeshFilter because then we will replace the
172172
// exported mesh with the old mesh
173173
if (!(toComponent is MeshFilter)) {
174-
success = UnityEditorInternal.ComponentUtility.PasteComponentValues (toComponent);
174+
if (toComponent is SkinnedMeshRenderer) {
175+
var skinnedMesh = toComponent as SkinnedMeshRenderer;
176+
var sharedMesh = skinnedMesh.sharedMesh;
177+
success = UnityEditorInternal.ComponentUtility.PasteComponentValues (toComponent);
178+
skinnedMesh.sharedMesh = sharedMesh;
179+
} else {
180+
success = UnityEditorInternal.ComponentUtility.PasteComponentValues (toComponent);
181+
}
175182
}
176183
} else {
177184
success = UnityEditorInternal.ComponentUtility.PasteComponentAsNew (to);

0 commit comments

Comments
 (0)