I'm making a 2D mobile platformer and I just figured out how to make the mobile buttons work. But I can't get the jump limit to work. Does anyone know how to create maybe a ground detection with this script?

Rigidbody2D playerRigidbody = null;

public GUITexture buttonTexture = null;

void Start()
{
	playerRigidbody = playerObject.GetComponent<Rigidbody2D>();
}

void Update()
{
	TouchInput (buttonTexture);
}
void OnFirstTouchBegan()
{
	switch (buttonType) 
	{
	case type.JumpButton:
		playerRigidbody.AddForce (Vector2.up * jumpHeight, ForceMode2D.Impulse);
		break;
	}
}

void OnSecondTouchBegan()
{
	switch (buttonType) 
	{
	case type.JumpButton:
		playerRigidbody.AddForce (Vector2.up * jumpHeight, ForceMode2D.Impulse);
		break;
	}
}

void OnFirstTouch()
{
	switch (buttonType)
	{
	case type.LeftButton:
		playerObject.transform.Translate(-Vector2.right * moveSpeed * Time.deltaTime);
		break;
	case type.RightButton:
		playerObject.transform.Translate(Vector2.right * moveSpeed * Time.deltaTime);
		break;
	}
}

void OnSecondTouch()
{
	switch (buttonType)
	{
	case type.LeftButton:
		playerObject.transform.Translate(-Vector2.right * moveSpeed * Time.deltaTime);
		break;
	case type.RightButton:
		playerObject.transform.Translate(Vector2.right * moveSpeed * Time.deltaTime);
		break;
	}
}

}

https://unity3d.com/learn/tutorials/modules/beginner/2d/2d-controllers
This video may be what you want. It’s a long video but around 50 min in he starts talking about jumping and ground detection.