diff --git a/Scripts/UIParticleUpdater.cs b/Scripts/UIParticleUpdater.cs index 1e1b717..e5ca8ff 100755 --- a/Scripts/UIParticleUpdater.cs +++ b/Scripts/UIParticleUpdater.cs @@ -11,6 +11,7 @@ namespace Coffee.UIExtensions static readonly List s_ActiveParticles = new List(); static MaterialPropertyBlock s_Mpb; static ParticleSystem.Particle[] s_Particles = new ParticleSystem.Particle[2048]; + private static int frameCount = 0; public static void Register(UIParticle particle) @@ -41,6 +42,10 @@ namespace Coffee.UIExtensions private static void Refresh() { + // Do not allow it to be called in the same frame. + if (frameCount == Time.frameCount) return; + frameCount = Time.frameCount; + Profiler.BeginSample("[UIParticle] Refresh"); for (var i = 0; i < s_ActiveParticles.Count; i++) {