I've followed some simple tutorials on Udemy and Youtube, and I created a player controller that involves walking and attacking. I cannot seem to figure out why I can't attack while holding down 2 directional inputs. The attack animation plays when I am moving up and right, but not down/right, down/left, or up/left.
Here is the code I am using
void Update()
{
//Movement
theRB.velocity = new Vector2(Input.GetAxisRaw("Horizontal"), (Input.GetAxisRaw("Vertical"))) * moveSpeed;
myAnim.SetFloat("moveX", theRB.velocity.x);
myAnim.SetFloat("moveY", theRB.velocity.y);
//Attack
if (Input.GetKeyDown(KeyCode.Space))
{
Attack();
}
void Attack()
{
myAnim.SetTrigger("Attack");
}
}
I understand that the Attack() method has no effect yet besides the animation, but I cannot get the animation to play while moving diagonally. Any help would be appreciated.

