Trouble with jumping mechanics

Hi,
I’m trying to make a simple move and jump script to my character but the physics does not apply when I jump. The character simply doesn’t fall back to the ground.

  • It has the ridigbody2D component (with mass and gravity scale above 0)
  • I’m new on unity
  • I know there’re easier ways to make the character move on axis X

Here’s my code:
public float speed = 3f, jump = 50f;
Rigidbody2D playerRb;

// Use this for initialization
void Start () {
	playerRb = GetComponent<Rigidbody2D> ();


}

// Update is called once per frame
void Update () {
	playerRb.velocity = new Vector2(speed,jump);

	if (Input.GetKey (KeyCode.RightArrow)) {
		speed = 3;
	} 
	if (Input.GetKey (KeyCode.LeftArrow)) {
		speed = -3;
	}
	if (Input.GetKeyDown (KeyCode.Space)) {
		playerRb.AddForce(Vector2.up * jump);

		
	}

}
}

It worked! just for didactic purposes, why does gravity not apply on (playerRb.AddForce(Vector2.up * jump):wink: but on playerRb.velocity = new Vector2 (playerRb.velocity.x,jump);

btw, Thanks so much!