diff --git a/Scripts/UIParticle.cs b/Scripts/UIParticle.cs index cf6dbf3..9697e28 100644 --- a/Scripts/UIParticle.cs +++ b/Scripts/UIParticle.cs @@ -298,6 +298,11 @@ namespace Coffee.UIExtensions } } + for (var i = 0; i < m_Renderers.Count; i++) + { + m_Renderers[i].Reset(i); + } + var j = 0; for (var i = 0; i < particles.Count; i++) { @@ -308,11 +313,6 @@ namespace Coffee.UIExtensions GetRenderer(j++).Set(this, particles[i], true); } } - - for (; j < m_Renderers.Count; j++) - { - GetRenderer(j).Clear(j); - } } internal void UpdateTransformScale() @@ -400,7 +400,7 @@ namespace Coffee.UIExtensions { _tracker.Clear(); UIParticleUpdater.Unregister(this); - m_Renderers.ForEach(r => r.Clear()); + m_Renderers.ForEach(r => r.Reset()); UnregisterDirtyMaterialCallback(UpdateRendererMaterial); base.OnDisable(); diff --git a/Scripts/UIParticleRenderer.cs b/Scripts/UIParticleRenderer.cs index 83c8548..f1e7c6e 100644 --- a/Scripts/UIParticleRenderer.cs +++ b/Scripts/UIParticleRenderer.cs @@ -134,7 +134,7 @@ namespace Coffee.UIExtensions return modifiedMaterial; } - public void Clear(int index = -1) + public void Reset(int index = -1) { if (_renderer) {