bool IsHaveTargetEvent(GameObject go, string triggerName)
{
Animator animator = go.GetComponentInChildren<Animator>();
Debug.Assert(animator != null, string.Format("{0} 缺少 Animator Com", go.name));
if (animator == null)
{
return false;
}
UnityEditor.Animations.AnimatorController controller = animator.runtimeAnimatorController as UnityEditor.Animations.AnimatorController;
Debug.Assert(controller != null, string.Format("{0} 缺少 animator controller", go.name));
if (controller == null)
{
return false;
}
UnityEditor.Animations.AnimatorStateMachine baseStateMachine = controller.layers[0].stateMachine;
foreach (UnityEditor.Animations.AnimatorStateTransition t in baseStateMachine.anyStateTransitions)
{
foreach (UnityEditor.Animations.AnimatorCondition c in t.conditions)
{
if (trigger
Unity3D 获得 Animator 的 Trigger 和 Event
最新推荐文章于 2025-06-29 23:53:48 发布