title: How do I keep a constant velocity in Unity 2d?
body: <p>I am quiet new to Unity and C#. I am tring to develop my first game, and a lot of the syntax confuses me. I am trying to move my sprite in the x axis using force, when "a" or "d" or the arrow keys are pressed, but it seems that my sprite doesnt move at a constant velocity.</p>
  
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using UnityEngine.UI;
  
  public class playerMovement : MonoBehaviour
  {
      public float vel = .5f;
      public float jumpVel = 10f;
      public bool isGrounded = false;
      private Rigidbody2D rb;
  
      // Start is called before the first frame update
      void Start()
      {
          rb = transform.GetComponent&lt;Rigidbody2D&gt;();
      }
  
      // Update is called once per frame
      void Update()
      {
          //Vector3 move = new Vector3(Input.GetAxisRaw("Horizontal"), 0f,0f);
          //transform.position += move * Time.deltaTime * vel;
          if(Input.GetAxisRaw("Horizontal") == 1){
              rb.AddForce(Vector2.right*vel, ForceMode2D.Force);
          }else if(Input.GetAxisRaw("Horizontal") == -1){
              rb.AddForce(Vector2.right*-vel, ForceMode2D.Force);
          }
          if(Input.GetKeyDown(KeyCode.Space) &amp;&amp; isGrounded == true){
              rb.velocity = Vector2.up * jumpVel;
          }
  
      }
  }
  </code></pre>