A better jump mechanic

My jump function right now looks a bit odd. It’s as if the player teleports up a certain height and then falls back down with gravity

Here is what I have so far, there’s got to be a better way…

void Jump()
{
	transform.Translate (Vector2.up * jumpForce * Time.deltaTime);
}

Assuming you’re using a Rigidbody2D, try Rigidbody2D.AddForce. transform.Translate changes the position, not the force.

as @GarbagePile said using Rigidbody2D will be a very nice and simple way .you just have to attach a Rigidbody2D component to your object.

     public RigidBody2D rig;
        public int jumpHeight;

     void Start(){
    rig = GetComponent<Rigidbody2D> ();
       }

        void Jump(){

       rig.velocity = new Vector2 (rig.velocity.x,jumpHeight);

       }