Skip to content

Commit febaa48

Browse files
committed
Copy over duplicate components as new components
1 parent e93813a commit febaa48

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Assets/FbxExporters/Editor/ConvertToModel.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,11 @@ private static void CopyComponents(GameObject from, GameObject to){
285285

286286
bool success = UnityEditorInternal.ComponentUtility.CopyComponent (components[i]);
287287
if (success) {
288-
// if to already has this component, then copy the values over
288+
// if "to" already has this component, and it is not a MeshFilter, Transform, or Renderer, then paste as new.
289+
// We can't have multiple MeshFilters, Transforms, or Renderers, but we can have multiple
290+
// of other components.
289291
var toComponent = to.GetComponent (components [i].GetType ());
290-
if (toComponent == null) {
292+
if (toComponent == null || !(toComponent is MeshFilter || toComponent is Transform || toComponent is Renderer)) {
291293
success = UnityEditorInternal.ComponentUtility.PasteComponentAsNew (to);
292294
} else{
293295
// Don't want to copy MeshFilter because then we will replace the

0 commit comments

Comments
 (0)