title: Unity 2d Movement script issue
body: <p>So I'm making a 2d platformer in Unity, (Still new to c# and Unity as well), and I'm trying to make a movement script for a simple square, and the square will randomly stop moving, and I'll have to jump to start moving again, only for it to happen once more.</p>
  
  <pre><code>public class PlayerMovement : MonoBehaviour
  {
      public float moveSpeed;
      public float jumpHeight;
  
      void Start()
      {
      }
  
      void Update()
      {
          if (Input.GetKeyDown(KeyCode.Space))
          {
              GetComponent&lt;Rigidbody2D&gt;().velocity = new Vector2(GetComponent&lt;Rigidbody2D&gt;().velocity.x, jumpHeight);
          }
  
          if (Input.GetKey(KeyCode.D))
          {
              GetComponent&lt;Rigidbody2D&gt;().velocity = new Vector2(moveSpeed, 0);
          }
  
          if (Input.GetKey(KeyCode.A))
          {
              GetComponent&lt;Rigidbody2D&gt;().velocity = new Vector2(-moveSpeed, 0);
          }
      }
  }
  </code></pre>