Skip to content

Commit

Permalink
fix: material dirty on validate (on editor)
Browse files Browse the repository at this point in the history
  • Loading branch information
mob-sakai committed Oct 4, 2020
1 parent a508c3b commit fa34301
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Packages/UIParticle/Scripts/Editor/UIParticleEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,17 @@ public override void OnInspectorGUI()
.Select(x => x.GetComponent<ParticleSystemRenderer>().sharedMaterial)
.Where(x => x)
.ToArray();

// Animated properties
EditorGUI.BeginChangeCheck();
AnimatedPropertiesEditor.DrawAnimatableProperties(_spAnimatableProperties, mats);
if (EditorGUI.EndChangeCheck())
{
foreach (UIParticle t in targets)
t.SetMaterialDirty();
}

// Target ParticleSystems.
_ro.DoLayoutList();

serializedObject.ApplyModifiedProperties();
Expand Down
8 changes: 8 additions & 0 deletions Packages/UIParticle/Scripts/UIParticle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,14 @@ private void InitializeIfNeeded()
}

#if UNITY_EDITOR
protected override void OnValidate()
{
SetLayoutDirty();
SetVerticesDirty();
m_ShouldRecalculateStencil = true;
RecalculateClipping();
}

void ISerializationCallbackReceiver.OnBeforeSerialize()
{
if (Application.isPlaying) return;
Expand Down

0 comments on commit fa34301

Please sign in to comment.