From e3f42d747a7fd973b5813cc72a9444943a6c3ad0 Mon Sep 17 00:00:00 2001 From: mob-sakai Date: Wed, 24 Feb 2021 16:22:37 +0900 Subject: [PATCH] fix: fix cached position for pre-warmed particles --- Scripts/UIParticle.cs | 1 - Scripts/UIParticleUpdater.cs | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Scripts/UIParticle.cs b/Scripts/UIParticle.cs index 26540f4..94e0dd3 100755 --- a/Scripts/UIParticle.cs +++ b/Scripts/UIParticle.cs @@ -395,7 +395,6 @@ namespace Coffee.UIExtensions #if !SERIALIZE_FIELD_MASKABLE maskable = m_Maskable; #endif - _cachedPosition = transform.position; activeMeshIndices.Clear(); UIParticleUpdater.Register(this); diff --git a/Scripts/UIParticleUpdater.cs b/Scripts/UIParticleUpdater.cs index 69729e1..1e1b717 100755 --- a/Scripts/UIParticleUpdater.cs +++ b/Scripts/UIParticleUpdater.cs @@ -154,6 +154,9 @@ namespace Coffee.UIExtensions particle.cachedPosition = position; + if (particle.activeMeshIndices.CountFast() == 0) + diff = Vector3.zero; + for (var i = 0; i < particle.particles.Count; i++) { Profiler.BeginSample("[UIParticle] Bake Mesh > Push index");