I am using a click to move mechanic for my game and I am now doing the animation, but the vertical and horizontal positions are not changing in the animator and so no walking or idle animation occur for the object, I am new to unity and coding so I am abit stuck atm.
This is my coding for the player movement:
```
private Vector3 target;
void Start()
{
target = transform.position;
}
void Update()
{
float horizontal = Input.GetAxis("Horizontal");
float vertical = Input.GetAxis("Vertical");
// Set the horizontal and vertical values in the animator
anim.SetFloat("Horizontal", horizontal);
anim.SetFloat("Vertical", vertical);
if (Input.GetMouseButtonDown(0))
{
target = Camera.main.ScreenToWorldPoint(Input.mousePosition);
target.z = transform.position.z;
}
transform.position = Vector3.MoveTowards(transform.position, target, speed * Time.deltaTime);
}
}