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

This commit is contained in:
mob-sakai
2024-06-18 17:13:35 +09:00
parent f029b7508e
commit b82f79c2de
2 changed files with 32 additions and 41 deletions

View File

@@ -475,20 +475,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.
EditorApplication.delayCall += () =>
{
foreach (var uip in uiParticles)
{
if (!uip) continue;
uip.transform.localScale = Vector3.one;
}
};
}
#if UNITY_2021_2_OR_NEWER