title: Cannot seem to make my player jump in unity
body: <p>I'm working on a 2D game in Unity attempting to make my player jump. Despite watching tons of videos and adjusting the code many times, he simply won't jump when I press the space bar. After even checking the input manager in Unity, I'm sure it's a simple fix I'm missing somewhere but I don't see where it could be.</p>
  <pre><code>public class FoxyController : MonoBehaviour
  {
      Rigidbody2D rigidbody2d; 
      float horizontal;
      float vertical; 
      public float jumpVelocity = 10f; 
  
  void Start()
  {
      rigidbody2d = GetComponent&lt;Rigidbody2D&gt;();
  }
  
  
  void Update()
  {
      horizontal = Input.GetAxis(&quot;Horizontal&quot;);
      vertical = Input.GetAxis(&quot;Vertical&quot;);
  
  
      if (Input.GetKey(KeyCode.Space))
      { 
          Jump(); 
      }
  }
  
  
  void FixedUpdate()
  {
      Vector2 position= rigidbody2d.position;
      position.x = position.x + 4f * horizontal * Time.deltaTime;
      position.y = position.y + 4f * vertical * Time.deltaTime; 
  
      rigidbody2d.MovePosition(position);         
  }
  
  void Jump()
  {
      rigidbody2d.velocity = Vector2.up * jumpVelocity; 
  }
  </code></pre>
  <p>}</p>