Need Help! Trying to set up a trigger to play an attack animation. The animator is set up properly and the trigger parameter is set.
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class PlayerAttack : MonoBehaviour { Animator anim; Rigidbody playerRigidBody;
private new Animator animation;
private Rigidbody playerRigidbody;
void Awake()
{
animation = GetComponent<Animator>();
playerRigidbody = GetComponent<Rigidbody>();
}
void Attack()
{
if (Input.GetKeyDown(KeyCode.Space))
{
anim.SetTrigger("Attack_2");
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Trigger the Animation #2 after Animation #1 was triggered 0 Answers
Help with a door slam trap 0 Answers
I want my character to enter and exit car with animation 1 Answer
Vuforia (AR) Play animation on Target Image found (SCRIPT Help) 0 Answers
I am trying to get my player to trigger an animation brought over from Maya 0 Answers