This commit is contained in:
陈思海 2025-07-29 16:01:57 +08:00
parent acd6338626
commit 1998b9db2d

View File

@ -484,7 +484,7 @@ internal class UXButtonEditor : Editor
if (controller != null)
{
if (animator == null)
animator = (target as Selectable).gameObject.AddComponent<Animator>();
animator = (target as UXButton).gameObject.AddComponent<Animator>();
UnityEditor.Animations.AnimatorController.SetAnimatorController(animator, controller);
}
@ -514,11 +514,11 @@ internal class UXButtonEditor : Editor
var path = GetSaveControllerPath(target);
if (string.IsNullOrEmpty(path))
return null;
SerializedProperty normalTrigger = property.FindPropertyRelative("normalTrigger");
SerializedProperty highlightedTrigger = property.FindPropertyRelative("highlightedTrigger");
SerializedProperty pressedTrigger = property.FindPropertyRelative("pressedTrigger");
SerializedProperty selectedTrigger = property.FindPropertyRelative("selectedTrigger");
SerializedProperty disabledTrigger = property.FindPropertyRelative("disabledTrigger");
SerializedProperty normalTrigger = property.FindPropertyRelative("m_NormalTrigger");
SerializedProperty highlightedTrigger = property.FindPropertyRelative("m_HighlightedTrigger");
SerializedProperty pressedTrigger = property.FindPropertyRelative("m_PressedTrigger");
SerializedProperty selectedTrigger = property.FindPropertyRelative("m_SelectedTrigger");
SerializedProperty disabledTrigger = property.FindPropertyRelative("m_DisabledTrigger");
var normalName = string.IsNullOrEmpty(normalTrigger.stringValue) ? "Normal" : normalTrigger.stringValue;
var highlightedName = string.IsNullOrEmpty(highlightedTrigger.stringValue) ? "Highlighted" : highlightedTrigger.stringValue;