title: I am trying to set up my sprite position on the y-axis, but for some reason it keeps the 0 location
body: <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  
  public class Player : MonoBehaviour
  {
      private Vector3 targetPos;
      public float Xincrement;
  
      public float speed;
      public float maxWidth;
      public float minWidth;
  
      // Update is called once per frame
      private void Update()
      {
          transform.position = Vector3.MoveTowards(transform.position, targetPos, speed * Time.deltaTime);
  
          if (Input.GetKeyDown(KeyCode.RightArrow) &amp;&amp; transform.position.x &lt; maxWidth)
          {
              targetPos = new Vector3(transform.position.x + Xincrement, transform.position.y);
          }
          else if (Input.GetKeyDown(KeyCode.LeftArrow) &amp;&amp; transform.position.x &gt; minWidth)
          {
              targetPos = new Vector3(transform.position.x - Xincrement, transform.position.y);
          }
      }
  }
  </code></pre>