I’ve tried to use gameObject.GetComponent<Rigidbody2D>().AddForce(Vector2.up * jump);but that does not seem to work. If I change Vector2.up to something like Vector2.left or Vector2.right it works, but using Vector2.up does not. Can anyone give me some advice?
It could be that your objects up axis does not match the worlds. Try transform.up.
Or maybe it’s the ForceMode. Try using the following line:
gameObject.GetComponent<Rigidbody2D>().AddForce(Vector2.up * jump, ForceMode2D.Impulse);
Your answer solved my problem nearly 3 years later. ![]()
1 Like
Glad I could help