- Home /
How to manage 2D sprite animations correctly?
I have player unit that have 3 animation states and 8 directions. I switch the animation from the code:
private void Start()
{
_animator = GetComponent<Animator>();
}
public void Move(Vector2 moveDirection)
{
gameObject.transform.Translate(moveDirection.normalized * Speed * Time.deltaTime);
Direction = GetDirection(moveDirection.normalized).ToString();
LastMoveDirection = moveDirection.normalized;
_animator.speed = Speed * 0.5f;
_animator.Play("Moving" + Direction);
}
And when I had have only Idle and Run animations, everything works great, but when I tried to add Attack animation, revealed that it's a quite difficult. How to manage animations correctly?
animator.jpg
(41.8 kB)
Comment
Your answer
Follow this Question
Related Questions
Animator Condition Not Working 0 Answers
Shooter 2D: Character animation only runs once 1 Answer
Starting a 2D animation on a trigger 1 Answer
Play and Stop Animation 1 Answer
How to I create sudden movements using Unity's animator? 0 Answers