- Home /
Problem with multi touch
Hi,
I am having a problem on multitouch on android , i have a script for buttons and i have 4 buttons , the problem is when pressing a button then pressing another key that first touch stops working , i have searched much and have tried many times but I couldn't solve this problem , this is my touch script :
if(Input.touchCount > 0)
{
var touch: Touch = Input.touches[1];
if(touch.phase == TouchPhase.Stationary && guiTexture.HitTest(touch.position))
{
if(Target)
{
Target.SendMessage("Clicked",FunctionNo);
guiTexture.color = HoldColor;
}
}
if(touch.phase == TouchPhase.Ended && guiTexture.HitTest(touch.position))
{
if(Target)
{
Target.SendMessage("Clicked",-FunctionNo);
guiTexture.color = NormalColor;
}
}
}
thanks a lot.
Answer by lauriep · Jan 09, 2014 at 01:08 PM
Not sure if you fully understand how it works. Touches is an array and you are only querying one element of the array - Input.touches[1];
To work with the array, you need some sort of loop. See doco - http://docs.unity3d.com/Documentation/ScriptReference/Input-touches.html
Hope it helps - only a beginner myself.
Your answer
Follow this Question
Related Questions
Android Button Screen 1 Answer
Store/Stack Items 0 Answers
Does GUI stays on the same place no mather the device? 0 Answers
(UNSOLVED) Touch.deltaPosition on two fingers??How?? 2 Answers
Using a screen-drawn line to check for a collision [Vectrosity] 5 Answers