public static void Clear(this CombineInstance[] self) { for (var i = 0; i < self.Length; i++) { MeshPool.Return(self[i].mesh); self[i].mesh = null; } }
private static void InitializeOnLoad() { MeshHelper.Init(); MeshPool.Init(); CombineInstanceArrayPool.Init(); Canvas.willRenderCanvases -= Refresh; Canvas.willRenderCanvases += Refresh; }
/// <summary> /// This function is called when the behaviour becomes disabled. /// </summary> protected override void OnDisable() { UIParticleUpdater.Unregister(this); if (!_shouldBeRemoved) particles.Exec(p => p.GetComponent<ParticleSystemRenderer>().enabled = true); _tracker.Clear(); // Destroy object. MeshPool.Return(_bakedMesh); _bakedMesh = null; base.OnDisable(); }
public void Clear() { for (var i = 0; i < combineInstances.Count; i++) { var inst = combineInstances[i]; MeshPool.Return(inst.mesh); inst.mesh = null; combineInstances[i] = inst; } combineInstances.Clear(); MeshPool.Return(mesh); mesh = null; count = 0; hash = -1; index = -1; }
/// <summary> /// This function is called when the object becomes enabled and active. /// </summary> protected override void OnEnable() { _cachedPosition = transform.localPosition; _activeMeshIndices = 0; UIParticleUpdater.Register(this); particles.Exec(p => p.GetComponent <ParticleSystemRenderer>().enabled = false); if (isActiveAndEnabled && m_IgnoreCanvasScaler) { _tracker.Add(this, rectTransform, DrivenTransformProperties.Scale); } // Create objects. _bakedMesh = MeshPool.Rent(); base.OnEnable(); InitializeIfNeeded(); }
/// <summary> /// This function is called when the object becomes enabled and active. /// </summary> protected override void OnEnable() { #if !SERIALIZE_FIELD_MASKABLE maskable = m_Maskable; #endif activeMeshIndices.Clear(); UIParticleUpdater.Register(this); particles.Exec(p => p.GetComponent <ParticleSystemRenderer>().enabled = false); if (isActiveAndEnabled && m_IgnoreCanvasScaler) { _tracker.Add(this, rectTransform, DrivenTransformProperties.Scale); } // Create objects. _bakedMesh = MeshPool.Rent(); base.OnEnable(); InitializeIfNeeded(); }
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 Mesh GetTemporaryMesh() { return(MeshPool.Rent()); }
public static void DiscardTemporaryMesh(Mesh mesh) { MeshPool.Return(mesh); }