Two buttons (Quads) are not working at a same time.

Hello,

I have created two buttons using Quad, one for acceleration & other for rotation. Both are working properly , if i press one after another. But if i press both the buttons at a same time , they are not working, only one of them is working, which is pressed first.

For it, i have used OnMouseDown & OnMouseUp to maintain state,I have used same code for both buttons.
The code is as follows:

	// Update is called once per frame
	void Update ()
	{
			if (isPressed && isStarted)
			{
				if (canContinueIncrease)
					mySpeed = mySpeed + 0.05f;

				if (mySpeed >= 1f)
					{
					mySpeed = 1f;
					canContinueIncrease = false;
					}
			//	print("mySpeed:"+mySpeed);
			}
			else if (!isPressed && isStarted)
			{
				if (canContinueDecrease)
					mySpeed = mySpeed - 0.05f;
				
		if (mySpeed <= 0f && canContinueDecrease)
				{
					mySpeed = 0f;
					canContinueDecrease = false;
				}
			//	print("mySpeed:"+mySpeed);
			}
}

    void OnMouseDown ()
	{
			mySpeed = 0f;
			isPressed = true;
			isStarted = true;
			canContinueIncrease= true;
		//	print("Started Up mySpeed");
	}

	void OnMouseUp ()
	{
			isPressed = false;
			canContinueDecrease = true;
	}.

So Please help me at where i am doing wrong.

Thanks in advance.

You are using OnMousedown. Mouse down can’t detect multiple touch points, for that you should instead use Input.Touches.

I have tried using below code,and its working.

                Ray ray = Camera.main.ScreenPointToRay(touch.position);
				RaycastHit hit;
				if (Physics.Raycast(ray, out hit, 100))
				{
					if(hit.transform.gameObject == gameObject)
					{
						upTest.mySpeed = 0f;
						isPressed = true;
						isStarted = true;
						canContinueDecrease= true;
						isSameObject = true;
					}
				}

Thank you so much…