Skip to content

Commit

Permalink
feat: 3.0.0 updater
Browse files Browse the repository at this point in the history
  • Loading branch information
mob-sakai committed Aug 19, 2020
1 parent fe85fed commit f99292b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Packages/UIParticle/Scripts/UIParticle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ private Material GetModifiedMaterial(Material baseMaterial, int index)
/// </summary>
protected override void OnEnable()
{
UpdateVersionIfNeeded();

_tracker.Add(this, rectTransform, DrivenTransformProperties.Scale);

// Initialize.
Expand Down Expand Up @@ -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<UIParticle>();
if (m_IgnoreParent || !parent)
scale3D = m_Scale * transform.localScale;
else
scale3D = transform.localScale;
m_Scale = 0;
}
}
}

0 comments on commit f99292b

Please sign in to comment.