From 11de6837812fb3ce799144705128969d82ec15a0 Mon Sep 17 00:00:00 2001 From: "eldar.zakaryaev" Date: Wed, 5 Jul 2023 11:24:50 +0300 Subject: [PATCH] Fix UIParticleSystem does not correspond to runtime lengthScale change --- Runtime/Scripts/Effects/UIParticleSystem.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Runtime/Scripts/Effects/UIParticleSystem.cs b/Runtime/Scripts/Effects/UIParticleSystem.cs index 2b24889..a004b7b 100644 --- a/Runtime/Scripts/Effects/UIParticleSystem.cs +++ b/Runtime/Scripts/Effects/UIParticleSystem.cs @@ -29,7 +29,6 @@ namespace UnityEngine.UI.Extensions private Vector2 textureSheetAnimationFrameSize; private ParticleSystemRenderer pRenderer; private bool isInitialised = false; - private float _lengthScale; private Material currentMaterial; @@ -96,7 +95,6 @@ namespace UnityEngine.UI.Extensions if (pRenderer != null) pRenderer.enabled = false; - _lengthScale = pRenderer.lengthScale; if (material == null) { var foundShader = ShaderLibrary.GetShaderInstance("UI Extensions/Particles/Additive"); @@ -285,8 +283,8 @@ namespace UnityEngine.UI.Extensions float rotation = -particle.rotation * Mathf.Deg2Rad; - var lengthScale = _lengthScale; - if (_useLengthScale) // this flag is mostly to secure old behaviour, it probably can be replaced with _lengthScale != 1 + var lengthScale = pRenderer.lengthScale; + if (_useLengthScale) { // rotate towards velocity var normalizedVelocity = particle.velocity.normalized;