So I have my player character with his animations set up, if he goes left it plays the animations if he stops it plays the left idle animations. What I also want to do, to change player idle animations by the mouse position. So basically if he is idle and you would move the mouse around him the sprites would change depending on the direction of the mouse. Unfortunately, I have no idea how to do this. So far I have made this but i get errors Code (CSharp): using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerMovement : MonoBehaviour { public float moveSpeed = 2f; public Rigidbody2D rb; Animator thisAnim; float lastX, lastY; void Start() { thisAnim = GetComponent<Animator>(); } // Update is called once per frame void Update() { Move(); } void Move() { Vector3 rightMovement = Vector3.right * moveSpeed * Time.deltaTime * Input.GetAxis("Horizontal"); Vector3 upMovement = Vector3.up * moveSpeed * Time.deltaTime * Input.GetAxis("Vertical"); Vector3 heading = Vector3.Normalize(rightMovement + upMovement); transform.position += rightMovement; transform.position += upMovement; UpdateAnimation(heading); } void UpdateAnimation(Vector3 dir) { if (dir.x == 0f && dir.y == 0f) { Vector3 mouseLocationPixels = new Vector3(Input.mousePosition.x, Input.mousePosition.y); Vector3 mouseLocationWorld = Camera.main.ScreenToWorldPoint(mouseLocationPixels); lookDirection = (mouseLocationWorld - transform.position).normalized; thisAnim.SetFloat("LastHorizontal", lookDirection); thisAnim.SetFloat("LastVertical", lookDirection); thisAnim.SetBool("Moving", false); } else { lastX = dir.x; lastY = dir.y; thisAnim.SetBool("Moving", true); } thisAnim.SetFloat("Horizontal", dir.x); thisAnim.SetFloat("Vertical", dir.y); } }