void Jumping() { //Setting the initial jump velocity if (Input.GetKey(jumpKey)) { if (onGround) { rb.velocity = new Vector2(rb.velocity.x, 0); rb.velocity += new Vector2(0, maxJumpVelocity); playSounds.PlayJump(); } } else { if (rb.velocity.y > minJumpVelocity) { rb.velocity = new Vector2(rb.velocity.x, minJumpVelocity); } } }