2 typo edited Jan 12 at 0:35 DMGregory♦ 72.5k1616 gold badges128128 silver badges204204 bronze badges You need to use curly braces { } to group together statements that you want to execute only when the condition of the if statement is met. if (condition) DoActionA(); DoActionB();  This says "Do action A only if condition is true, but always do action B no matter what" if (condition) { DoActionA(); DoActionB(); }  This instead says "Do action A then action B only if condition is true, otherwise skip them both" So, specific fixes: Don't call GetComponent every frame. That's just wasteful. Instead, call it during start-up and cache the result. Put the sprite assignments inside braces to bundle them with the if statements that should control them. Like so: // You could just make these public variables and assign the sprite in the inspector. Sprite UpSprite;upSprite; Sprite LeftSprite;leftSprite; SpriteRenderer myRenderer; void Start() { dest = transform.position; speed = 25; // Cache our sprites & renderer. myRenderer = GetComponent(); upSprite = GameObject.Find("up").GetComponent().sprite; leftSprite = GameObject.Find("left").GetComponent().sprite; } void FixedUpdate() { if (Input.GetKey("w")) { transform.position = Vector3.MoveTowards(transform.position, points[0].position, speed * Time.deltaTime); myRenderer.sprite = upSprite; } if...  You need to use curly braces { } to group together statements that you want to execute only when the condition of the if statement is met. if (condition) DoActionA(); DoActionB();  This says "Do action A only if condition is true, but always do action B no matter what" if (condition) { DoActionA(); DoActionB(); }  This instead says "Do action A then action B only if condition is true, otherwise skip them both" So, specific fixes: Don't call GetComponent every frame. That's just wasteful. Instead, call it during start-up and cache the result. Put the sprite assignments inside braces to bundle them with the if statements that should control them. Like so: // You could just make these public variables and assign the sprite in the inspector. Sprite UpSprite; Sprite LeftSprite; SpriteRenderer myRenderer; void Start() { dest = transform.position; speed = 25; // Cache our sprites & renderer. myRenderer = GetComponent(); upSprite = GameObject.Find("up").GetComponent().sprite; leftSprite = GameObject.Find("left").GetComponent().sprite; } void FixedUpdate() { if (Input.GetKey("w")) { transform.position = Vector3.MoveTowards(transform.position, points[0].position, speed * Time.deltaTime); myRenderer.sprite = upSprite; } if...  You need to use curly braces { } to group together statements that you want to execute only when the condition of the if statement is met. if (condition) DoActionA(); DoActionB();  This says "Do action A only if condition is true, but always do action B no matter what" if (condition) { DoActionA(); DoActionB(); }  This instead says "Do action A then action B only if condition is true, otherwise skip them both" So, specific fixes: Don't call GetComponent every frame. That's just wasteful. Instead, call it during start-up and cache the result. Put the sprite assignments inside braces to bundle them with the if statements that should control them. Like so: // You could just make these public variables and assign the sprite in the inspector. Sprite upSprite; Sprite leftSprite; SpriteRenderer myRenderer; void Start() { dest = transform.position; speed = 25; // Cache our sprites & renderer. myRenderer = GetComponent(); upSprite = GameObject.Find("up").GetComponent().sprite; leftSprite = GameObject.Find("left").GetComponent().sprite; } void FixedUpdate() { if (Input.GetKey("w")) { transform.position = Vector3.MoveTowards(transform.position, points[0].position, speed * Time.deltaTime); myRenderer.sprite = upSprite; } if...  1 answered Jan 12 at 0:19 DMGregory♦ 72.5k1616 gold badges128128 silver badges204204 bronze badges You need to use curly braces { } to group together statements that you want to execute only when the condition of the if statement is met. if (condition) DoActionA(); DoActionB();  This says "Do action A only if condition is true, but always do action B no matter what" if (condition) { DoActionA(); DoActionB(); }  This instead says "Do action A then action B only if condition is true, otherwise skip them both" So, specific fixes: Don't call GetComponent every frame. That's just wasteful. Instead, call it during start-up and cache the result. Put the sprite assignments inside braces to bundle them with the if statements that should control them. Like so: // You could just make these public variables and assign the sprite in the inspector. Sprite UpSprite; Sprite LeftSprite; SpriteRenderer myRenderer; void Start() { dest = transform.position; speed = 25; // Cache our sprites & renderer. myRenderer = GetComponent(); upSprite = GameObject.Find("up").GetComponent().sprite; leftSprite = GameObject.Find("left").GetComponent().sprite; } void FixedUpdate() { if (Input.GetKey("w")) { transform.position = Vector3.MoveTowards(transform.position, points[0].position, speed * Time.deltaTime); myRenderer.sprite = upSprite; } if...