You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

按下按钮无法播放Attack动画,Animator触发器未激活求助

Unity Attack动画触发器无法触发问题

Animator面板截图

我尝试通过触发名为Attack的参数来播放Attack动画,但按下指定的触发按键(C键)后,动画无法运行,触发器也未激活。

以下是我的代码:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class attack : MonoBehaviour
{
    public Animator animator;

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.C))
        {
            Attack();
        }
    }

    void Attack()
    {
        animator.SetTrigger("Attack");
    }
}

我是跟着一段视频进行操作的。

内容的提问来源于stack exchange,提问作者Omar afandi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.21 04:15:48