feat: restore Transform.localScale when setting autoScalingMode to something other than Transform

# Conflicts:
#	Packages/src/Editor/UIParticleEditor.cs
#	Packages/src/Runtime/UIParticle.cs
This commit is contained in:
mob-sakai
2024-06-18 17:13:35 +09:00
parent e741584507
commit dfb94f4bad
2 changed files with 32 additions and 46 deletions

View File

@@ -401,25 +401,7 @@ namespace Coffee.UIExtensions
private static void DrawAutoScaling(SerializedProperty prop, IEnumerable<UIParticle> uiParticles)
{
var isTransformMode = prop.intValue == (int)UIParticle.AutoScalingMode.Transform;
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(prop);
if (!EditorGUI.EndChangeCheck() || !isTransformMode) return;
// on changed true->false, reset scale.
ResetScale(uiParticles);
}
private static void ResetScale(IEnumerable<UIParticle> uiParticles)
{
EditorApplication.delayCall += () =>
{
foreach (var uip in uiParticles)
{
if (!uip) continue;
uip.transform.localScale = Vector3.one;
}
};
}
private void DestroyUIParticle(UIParticle p, bool ignoreCurrent = false)