void LateUpdate() { /* Clear Finalize ListDrawMesh */ if (null == arrayListMeshDraw) { arrayListMeshDraw = new Library_SpriteStudio.DrawManager.ArrayListMeshDraw(); arrayListMeshDraw.BootUp(); arrayListMeshDraw.RenderQueueSet(KindRenderQueueBase, OffsetDrawQueue); } arrayListMeshDraw.Clear(); /* Collect Draw-Parts from Root-Parts */ #if true /* MEMO: Measures to Garbage-Collect */ Library_SpriteStudio.DrawManager.ArrayListMeshDraw ArrayListMeshDrawObject = null; Library_SpriteStudio.DrawManager.ListMeshDraw ListMeshDraw = null; foreach (var DrawObject in DrawEntryPartsRoot.OrderByDescending(x => x.OrderGetDisplay())) #else InformationDrawObject DrawObject = null; Library_SpriteStudio.DrawManager.ArrayListMeshDraw ArrayListMeshDrawObject = null; Library_SpriteStudio.DrawManager.ListMeshDraw ListMeshDraw = null; int Count = DrawEntryPartsRoot.Count; for (int i = 0; i < Count; i++) #endif { #if true /* MEMO: Measures to Garbage-Collect */ ArrayListMeshDrawObject = DrawObject.ArrayListMeshDraw; #else #if false /* MEMO: Non-Generic List-Class */ DrawObject = DrawEntryPartsRoot[i] as InformationDrawObject; #else DrawObject = DrawEntryPartsRoot[i]; #endif ArrayListMeshDrawObject = DrawObject.PartsRoot.ArrayListMeshDraw; #endif int CountList = ArrayListMeshDrawObject.TableListMesh.Count; for (int j = 0; j < CountList; j++) { /* Add Mesh-List */ #if false /* MEMO: Non-Generic List-Class */ ListMeshDraw = ArrayListMeshDrawObject.TableListMesh[j] as Library_SpriteStudio.DrawManager.ListMeshDraw; #else ListMeshDraw = ArrayListMeshDrawObject.TableListMesh[j]; #endif arrayListMeshDraw.TableListMesh.Add(ListMeshDraw); } /* Clear Original Draw-List */ #if true /* MEMO: Measures to Garbage-Collect */ DrawObject.DrawListClear(); #else DrawObject.PartsRoot.DrawListClear(); #endif } DrawEntryPartsRoot.Clear(); /* Collect & Add Draw-Parts "Instance"-Object's Parts */ Library_SpriteStudio.DrawManager.InformationMeshData InformationMeshData = null; Script_SpriteStudio_PartsRoot ScriptPartsRootSub = null; for (int i = 0; i < arrayListMeshDraw.TableListMesh.Count;) { #if false /* MEMO: Non-Generic List-Class */ ListMeshDraw = arrayListMeshDraw.TableListMesh[i] as Library_SpriteStudio.DrawManager.ListMeshDraw; #else ListMeshDraw = arrayListMeshDraw.TableListMesh[i]; #endif if (null == ListMeshDraw) { arrayListMeshDraw.TableListMesh.RemoveAt(i); continue; } InformationMeshData = ListMeshDraw.MeshDataTop; if (null != InformationMeshData.PartsInstance) { Library_SpriteStudio.DrawManager.ListMeshDraw ListMeshDrawSub = null; ScriptPartsRootSub = InformationMeshData.PartsInstance.ScriptPartsRootSub; if (null != ScriptPartsRootSub) { /* Add Mesh-Table */ /* Delete "Instance"-Data */ arrayListMeshDraw.TableListMesh.RemoveAt(i); /* Insert "Instance"-Data's Draw-Mesh-List */ ArrayListMeshDrawObject = ScriptPartsRootSub.ArrayListMeshDraw; for (int j = 0; j < ArrayListMeshDrawObject.TableListMesh.Count; j++) { #if false /* MEMO: Non-Generic List-Class */ ListMeshDrawSub = ArrayListMeshDrawObject.TableListMesh[j] as Library_SpriteStudio.DrawManager.ListMeshDraw; #else ListMeshDrawSub = ArrayListMeshDrawObject.TableListMesh[j]; #endif arrayListMeshDraw.TableListMesh.Insert((i + j), ListMeshDrawSub); } /* Clear Original Draw-List */ ScriptPartsRootSub.DrawListClear(); continue; } } i++; } /* Optimize Draw-Parts List */ Library_SpriteStudio.DrawManager.ListMeshDraw ListMeshDrawNext = null; #if false /* MEMO: Non-Generic List-Class */ ArrayList TableListMesh = arrayListMeshDraw.TableListMesh; #else List <Library_SpriteStudio.DrawManager.ListMeshDraw> TableListMesh = arrayListMeshDraw.TableListMesh; #endif for (int i = 0; i < (TableListMesh.Count - 1);) { #if true /* MEMO: Measures to Garbage-Collect */ int Count = i + 1; #else Count = i + 1; /* "Count" is temporary */ #endif #if false /* MEMO: Non-Generic List-Class */ ListMeshDraw = TableListMesh[i] as Library_SpriteStudio.DrawManager.ListMeshDraw; ListMeshDrawNext = TableListMesh[Count] as Library_SpriteStudio.DrawManager.ListMeshDraw; #else ListMeshDraw = TableListMesh[i]; ListMeshDrawNext = TableListMesh[Count]; #endif if (ListMeshDraw.MaterialOriginal == ListMeshDrawNext.MaterialOriginal) { /* Mesh-List Merge */ ListMeshDraw.ListMerge(ListMeshDrawNext); TableListMesh.RemoveAt(Count); /* Counter No-Incliment Continue */ continue; } i++; } /* Counting Meshes */ TableListMesh = arrayListMeshDraw.TableListMesh; #if true /* MEMO: Measures to Garbage-Collect */ int CountMesh = 0; for (int i = 0; i < TableListMesh.Count; i++) #else Count = TableListMesh.Count; int CountMesh = 0; for (int i = 0; i < Count; i++) #endif { #if false /* MEMO: Non-Generic List-Class */ ListMeshDraw = TableListMesh[i] as Library_SpriteStudio.DrawManager.ListMeshDraw; #else ListMeshDraw = TableListMesh[i]; #endif CountMesh += ListMeshDraw.Count; } /* Meshes Combine each Material & Set to MeshFilter/MeshRenderer */ MeshFilter InstanceMeshFilter = GetComponent <MeshFilter>(); MeshRenderer InstanceMeshRenderer = GetComponent <MeshRenderer>(); // arrayListMeshDraw.MeshSetCombine(InstanceMeshFilter, InstanceMeshRenderer, InstanceCameraDraw, transform); arrayListMeshDraw.MeshSetCombine(InstanceMeshFilter, InstanceMeshRenderer, null, transform); }