public void Combine() { switch (count) { case 0: return; case 1: mesh = combineInstances[0].mesh; transform = combineInstances[0].transform; return; default: { var cis = CombineInstanceArrayPool.Get(combineInstances); mesh = MeshPool.Rent(); mesh.CombineMeshes(cis, true, true); transform = Matrix4x4.identity; cis.Clear(); return; } } }
public static void CombineMesh(Mesh result) { if (count == 0) { return; } for (var i = 0; i < count; i++) { Profiler.BeginSample("[UIParticle] MeshHelper > Combine Mesh Internal"); s_CachedInstance[i].Combine(); Profiler.EndSample(); } Profiler.BeginSample("[UIParticle] MeshHelper > Combine Mesh"); var cis = CombineInstanceArrayPool.Get(s_CachedInstance, count); result.CombineMeshes(cis, false, true); cis.Clear(); Profiler.EndSample(); result.RecalculateBounds(); }