From f99292b9a15c9c085efacc0330d6b848669fadfa Mon Sep 17 00:00:00 2001 From: mob-sakai Date: Thu, 20 Aug 2020 03:28:08 +0900 Subject: [PATCH] feat: 3.0.0 updater --- Packages/UIParticle/Scripts/UIParticle.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Packages/UIParticle/Scripts/UIParticle.cs b/Packages/UIParticle/Scripts/UIParticle.cs index 74e8023..263abcf 100755 --- a/Packages/UIParticle/Scripts/UIParticle.cs +++ b/Packages/UIParticle/Scripts/UIParticle.cs @@ -201,6 +201,8 @@ private Material GetModifiedMaterial(Material baseMaterial, int index) /// protected override void OnEnable() { + UpdateVersionIfNeeded(); + _tracker.Add(this, rectTransform, DrivenTransformProperties.Scale); // Initialize. @@ -327,5 +329,17 @@ internal void CheckMaterials() if (matChanged || matChanged2 || modeChanged) SetMaterialDirty(); } + + private void UpdateVersionIfNeeded() + { + if (Mathf.Approximately(m_Scale, 0)) return; + + var parent = GetComponentInParent(); + if (m_IgnoreParent || !parent) + scale3D = m_Scale * transform.localScale; + else + scale3D = transform.localScale; + m_Scale = 0; + } } }