How do i incorporate a double jump ingame?

I have a functioning 2D “sphere” ingame object and i have it resting on a cube object. I can successfully move it left and right, and jump an infinite amount of times in the directions i press. Im having an issue trying to figure out how to put a limit on the jump amount though. I want the sphere to only be able to double jump before it reaches some sort of cap and reached the ground, instead of being able to basically fly with how many jumps it has. Heres my snippet of code so far:

void Update () 
		{
		//the rotation gets the value of the input (on the horizontal axis) times the
		//value of the rotation speed
		float rotation = Input.GetAxis ("Horizontal") * rotationSpeed;
		//this rotation happens independantly as the frames refresh
		rotation *= Time.deltaTime;
		//sets a torque like movement to the rigidbody2d of the sphere, by minus 1
		//for opposite torqing direction, making right right and left left
		rigidbody2D.AddTorque (-1 * rotation);

		if (Input.GetKeyDown (KeyCode.UpArrow) && isFalling == false) 
		{

			rigidbody2D.velocity = new Vector2 (rigidbody2D.velocity.x, rotation);			
			rigidbody2D.velocity = new Vector2 (rigidbody2D.velocity.y, jumpHeight);
			isFalling = true;
		} 
		else 
		{
			isFalling = false;
		}
	}

	void OnCollisionStay ()
	{
		isFalling = false;
	}

Im still beginning, and im a bit all over the place since i tried multiple solutions but didnt delete any of them. Thanks in advance.

Hi,

I did also a doublejump check with the raycasting method. Simply check with a raycast if the ground is near and let the player jump if the ground is in range. The raycasting could be in a coroutine which triggers a bool variable to allow the jumping, or simply check before the jumping when the player presses the jump button.

Hope it helps,

Jusabian

www.kawetofe.com