浏览代码

Changed order of processing Unity objects

punkoffice 9 年之前
父节点
当前提交
ffa6c5b22e
共有 1 个文件被更改,包括 20 次插入14 次删除
  1. 20 14
      Exporters/Unity 5/Unity3D2Babylon/SceneBuilder.cs

+ 20 - 14
Exporters/Unity 5/Unity3D2Babylon/SceneBuilder.cs

@@ -116,21 +116,11 @@ namespace Unity3D2Babylon
             {
                 var progress = ((float)index / itemsCount);
                 index++;
-                // Static meshes
-                var meshFilter = gameObject.GetComponent<MeshFilter>();
-                if (meshFilter != null)
-                {                    
-                    ConvertUnityMeshToBabylon(meshFilter.sharedMesh, meshFilter.transform, gameObject, progress);
-                    continue;
-                }
 
-                // Skinned meshes
-                var skinnedMesh = gameObject.GetComponent<SkinnedMeshRenderer>();
-                if (skinnedMesh != null)
-                {
-                    ConvertUnityMeshToBabylon(skinnedMesh.sharedMesh, skinnedMesh.transform, gameObject, progress);
-                    continue;
-                }
+                /* 
+                    The order of processing is important here.
+                    We will only check if this is a mesh prefab if it is not a light or camera
+                */
 
                 // Light
                 var light = gameObject.GetComponent<Light>();
@@ -148,6 +138,22 @@ namespace Unity3D2Babylon
                     continue;
                 }
 
+                // Static meshes
+                var meshFilter = gameObject.GetComponent<MeshFilter>();
+                if (meshFilter != null)
+                {                    
+                    ConvertUnityMeshToBabylon(meshFilter.sharedMesh, meshFilter.transform, gameObject, progress);
+                    continue;
+                }
+
+                // Skinned meshes
+                var skinnedMesh = gameObject.GetComponent<SkinnedMeshRenderer>();
+                if (skinnedMesh != null)
+                {
+                    ConvertUnityMeshToBabylon(skinnedMesh.sharedMesh, skinnedMesh.transform, gameObject, progress);
+                    continue;
+                }
+
                 // Empty
                 ConvertUnityEmptyObjectToBabylon(gameObject);
             }