Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# animator.SetTrigger不触发动画_C#_Unity3d_Animator - Fatal编程技术网

C# animator.SetTrigger不触发动画

C# animator.SetTrigger不触发动画,c#,unity3d,animator,C#,Unity3d,Animator,我目前正在开发一款Beat'em Up风格的游戏,希望在mouse1 down上设置一个触发器,以使用SetTrigger执行打孔,请参见下面的代码片段: if (Input.GetButtonDown("Fire1")) { isAttacking = true; if (vertical != 0 || horizontal != 0) { vertical = 0;

我目前正在开发一款Beat'em Up风格的游戏,希望在mouse1 down上设置一个触发器,以使用SetTrigger执行打孔,请参见下面的代码片段:

if (Input.GetButtonDown("Fire1"))
    {
        isAttacking = true;
        if (vertical != 0 || horizontal != 0)
        {
            vertical = 0;
            horizontal = 0;
            animator.SetFloat("Speed", 0.0f);
        }

        animator.SetTrigger("Punch");
    }
问题是animator.SetTrigger无法识别我给它的动画名称,并表示它缺少该组件


谢谢大家。

以上问题的答案是在动画师中命名触发器参数,与我在c中命名的相同。

注意,
SetTrigger
需要触发器的名称。。不属于状态或动画片段