Binding animation to character using Animation controller

I started unity yesterday and I tried to bind moving left, right, up and down with animation controller, but my character doesn’t watch right direction. It would be pleasure what is wrong with me.

I set all transition’s from Idle and animation state conditions true and false.
Also, parameters are all boolean values

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class movement : MonoBehaviour
{
    [SerializeField]
    private float moveSpeed;
    private Animator anim;
    void Start()
    {
        //the issue:
        anim = GetComponent<Animator>();
    }
    // Update is called once per frame
    void Update()
    {
        float horizontalInput = Input.GetAxisRaw("Horizontal");
        float verticalInput = Input.GetAxisRaw("Vertical");

        Vector3 moveTo = new Vector3(horizontalInput, verticalInput, 0);

        transform.position += moveTo * moveSpeed *  Time.deltaTime;

        if (Input.GetKey(KeyCode.LeftArrow)){
		    anim.SetBool("moveLeft", true);
	    }
        else if(Input.GetKey(KeyCode.RightArrow)){
            anim.SetBool("moveRight", true);
        }
        else if(Input.GetKey(KeyCode.UpArrow)){
            anim.SetBool("moveUp", true);
        }
        else if(Input.GetKey(KeyCode.DownArrow)){
            anim.SetBool("moveDown", true);
        }
    }
}

Don’t see anything wrong with the code except that the booleans are not being reset back to false

Try using

Input.GetKeyUp()

and reset the booleans

For example:

Character is looking left (bool left = true, play left animation)

Player pressed right (bool right = true, but bool left is still true and there’s no transition from left to right, the transition in your animation controller was left to idle to right) so the character won’t turn to look right