fix: refresh button does not works in prefab edit mode

close #214
pull/225/head
mob-sakai 2022-07-01 15:38:11 +09:00
parent f97e6195e6
commit c1538a8399
1 changed files with 11 additions and 8 deletions

View File

@ -192,16 +192,10 @@ namespace Coffee.UIExtensions
foreach (UIParticle t in targets) foreach (UIParticle t in targets)
{ {
t.RefreshParticles(); t.RefreshParticles();
EditorUtility.SetDirty(t);
} }
} }
}; };
_ro.onReorderCallback = _ =>
{
foreach (UIParticle t in targets)
{
t.RefreshParticles(t.particles);
}
};
// On select UIParticle, refresh particles. // On select UIParticle, refresh particles.
foreach (UIParticle t in targets) foreach (UIParticle t in targets)
@ -269,9 +263,18 @@ namespace Coffee.UIExtensions
EditorGUILayout.PropertyField(m_AbsoluteMode); EditorGUILayout.PropertyField(m_AbsoluteMode);
// Target ParticleSystems. // Target ParticleSystems.
EditorGUI.BeginChangeCheck();
EditorGUI.BeginDisabledGroup(targets.OfType<UIParticle>().Any(x => !x.canvas));
_ro.DoLayoutList(); _ro.DoLayoutList();
EditorGUI.EndDisabledGroup();
serializedObject.ApplyModifiedProperties(); serializedObject.ApplyModifiedProperties();
if (EditorGUI.EndChangeCheck())
{
foreach (var uip in targets.OfType<UIParticle>())
{
uip.RefreshParticles(uip.particles);
}
}
// Does the shader support UI masks? // Does the shader support UI masks?
if (current.maskable && current.GetComponentInParent<Mask>()) if (current.maskable && current.GetComponentInParent<Mask>())