title: When I want my Player to jump he is flying (Unity2d)
body: <p>Hello I want to make my first game in 2D but when i want to Jump, my Player is flying and he doesnt come back to the ground. I don't know why it doesnt work. Hopefully someone can help me. Thank you. Here is my Code:</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  public class Move2D : MonoBehaviour
  {
      public float speed = 5f;
      public float jumpSpeed = 8f;
      private float movement = 0f;
      private Rigidbody2D rigidBody;
      // Use this for initialization
      void Start()
      {
          rigidBody = GetComponent&lt;Rigidbody2D&gt;();
      }
  
      // Update is called once per frame
      void Update()
      {
          movement = Input.GetAxis("Horizontal");
          if (movement &gt; 0f)
          {
              rigidBody.velocity = new Vector2(movement * speed, rigidBody.velocity.y);
          }
          else if (movement &lt; 0f)
          {
              rigidBody.velocity = new Vector2(movement * speed, rigidBody.velocity.y);
          }
          else
          {
              rigidBody.velocity = new Vector2(0, rigidBody.velocity.y);
          }
          if (Input.GetButtonDown("Jump"))
          {
              rigidBody.velocity = new Vector2(rigidBody.velocity.x, jumpSpeed);
          }
      }
  }
  </code></pre>