From c1538a83998608a30dc90944b05f8b75e165cf05 Mon Sep 17 00:00:00 2001 From: mob-sakai Date: Fri, 1 Jul 2022 15:38:11 +0900 Subject: [PATCH] fix: refresh button does not works in prefab edit mode close #214 --- Scripts/Editor/UIParticleEditor.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Scripts/Editor/UIParticleEditor.cs b/Scripts/Editor/UIParticleEditor.cs index d9abe57..cf9ccc1 100644 --- a/Scripts/Editor/UIParticleEditor.cs +++ b/Scripts/Editor/UIParticleEditor.cs @@ -192,16 +192,10 @@ namespace Coffee.UIExtensions foreach (UIParticle t in targets) { t.RefreshParticles(); + EditorUtility.SetDirty(t); } } }; - _ro.onReorderCallback = _ => - { - foreach (UIParticle t in targets) - { - t.RefreshParticles(t.particles); - } - }; // On select UIParticle, refresh particles. foreach (UIParticle t in targets) @@ -269,9 +263,18 @@ namespace Coffee.UIExtensions EditorGUILayout.PropertyField(m_AbsoluteMode); // Target ParticleSystems. + EditorGUI.BeginChangeCheck(); + EditorGUI.BeginDisabledGroup(targets.OfType().Any(x => !x.canvas)); _ro.DoLayoutList(); - + EditorGUI.EndDisabledGroup(); serializedObject.ApplyModifiedProperties(); + if (EditorGUI.EndChangeCheck()) + { + foreach (var uip in targets.OfType()) + { + uip.RefreshParticles(uip.particles); + } + } // Does the shader support UI masks? if (current.maskable && current.GetComponentInParent())