Animation Stops when 2 buttons are pressed.

So, i am making a walking animation on my character. But, whenever i press to buttons like “UpArrow” and “LeftArrow” at the same time, it works for that time then it screws up ALL the animations. Even the simple commands like ONLY “UpArrow” doesn’t work. The animation just freezes. I’ve tried telling it that if “UpArrow” and “LeftArrow” are down in the same condition to play the “strafeleft” animation but it doesn’t work.
Here is my Script

// Start is called before the first frame update
void Start()
{
    anim = GetComponent<Animator>();

}

// Update is called once per frame
void Update()
{   // Move 
    // Move Right, Left
    float Axis = Input.GetAxis("Horizontal") * speed;
    //Move Front, Baek
    float translation = Input.GetAxis("Vertical") * speed;

    translation *= Time.deltaTime;
    Axis *= Time.deltaTime;
    transform.Translate(Axis, 0, 0);
    transform.Translate(0, 0, translation);

    // animate go front 
    if (Input.GetKeyDown(KeyCode.UpArrow))
    {
        anim.SetTrigger("Towalking");
    }
    // animate iShtop
    if (Input.GetKeyUp(KeyCode.UpArrow) || Input.GetKeyUp(KeyCode.LeftArrow) || Input.GetKeyUp(KeyCode.RightArrow) || Input.GetKeyUp(KeyCode.DownArrow) )
    {
        anim.SetTrigger("Tostop");
    }
    //  animate go left
    if (Input.GetKeyDown(KeyCode.LeftArrow))
    {
        anim.SetTrigger("Tostrafeleft");

    }
    
    // animate go right
    if (Input.GetKeyDown(KeyCode.RightArrow))
    {
        anim.SetTrigger("Tostraferight");
    }
    
    // animate go baek
    if (Input.GetKeyDown(KeyCode.DownArrow))
    {
        anim.SetTrigger("Towalkback");

    }
    
    // animate go front,left
    if(Input.GetKeyDown(KeyCode.UpArrow) && Input.GetKeyDown(KeyCode.LeftArrow))
    {

        anim.SetTrigger("Tostrafeleft");
    }  

}

}

Hello!

Yes, its normal.

You detect the keys using if … if … if…

So is possible at same frame, more than 1 if sentence, so more than 1 trigger is acctivated!

try to use if, else if, else if, else if… To prevent this.

But then yo uwill not be able to move simultaeneusly 2 direction (diagonals).

Unless you do a else if for this cases!

Bye!