فهرست منبع

Check if object is a prefab instance

Store instances and their prefabs in the prefab dictionary so we can
process them later
punkoffice 10 سال پیش
والد
کامیت
ba60fe8e47
1فایلهای تغییر یافته به همراه16 افزوده شده و 0 حذف شده
  1. 16 0
      Exporters/Unity 5/Unity3D2Babylon/SceneBuilder.cs

+ 16 - 0
Exporters/Unity 5/Unity3D2Babylon/SceneBuilder.cs

@@ -139,6 +139,22 @@ namespace Unity3D2Babylon
                     continue;
                 }
 
+                // Check if this is a prefab instance
+                GameObject gobjPrefab = (GameObject)PrefabUtility.GetPrefabParent(gameObject);
+                if (gobjPrefab != null)
+                {
+                    //Add prefab to dictionary if it doesn't already exist
+                    if (!dicPrefabs.ContainsKey(gobjPrefab))
+                    {
+                        dicPrefabs[gobjPrefab] = new List<BabylonAbstractMesh>();
+                    }
+
+                    List<BabylonAbstractMesh> lstInstances = dicPrefabs[gobjPrefab];
+                    BabylonAbstractMesh instance = ConvertUnityMeshToInstance(gameObject);
+                    lstInstances.Add(instance);
+                    continue;
+                }
+
                 // Static meshes
                 var meshFilter = gameObject.GetComponent<MeshFilter>();
                 if (meshFilter != null)