How to Make 2D RigidBody Jump,How to Add Force to RigidBody2D to make it jump

void Jump()
{
if (Input.GetButtonDown(“Jump”))
{
gameObject.GetComponent().AddForce(new Vector2(0f, 5f), ForceMode2D.Impulse);
}

}

}
This is my code for jumping. For some reason whenever I press the Space Button it doesn’t add the force. Can someone help,I have a simple jump script that adds force to the RigidBody on the Y position by 5.
void Jump()
{
if (Input.GetButtonDown(“Jump”))
{
gameObject.GetComponent().AddForce(new Vector2(0f, 5f), ForceMode2D.Impulse);
}

}

}
But whenever I try to jump or press space in game, it won’t Jump. Can someone help?

First thing, you should save your RigidBody2D on Awake into a variable, so you don’t go to take it every jump.

For the jumping function you’ve tried to increase the value and see what happened?
In case you do that go to check the mass value in your component and adjust it by decreasing it