- Home /
Question by
thegreatdave · Nov 04, 2014 at 09:47 PM ·
mobiletouchguitexturecontrolsmultitouch
Multi touches problem
Here is my code: if (Input.touchCount > 0) { for(int i = 0; i < Input.touchCount; i++) { Touch t = Input.GetTouch(i);
if (t.phase == TouchPhase.Began) {
// Are we touching the left arrow?
if (guiLeft.HitTest (t.position, Camera.main)) {
moveLeft = true;
animBoy.SetTrigger("goingLeft");
}
// Are we touching the right arrow?
if (guiRight.HitTest (t.position, Camera.main)) {
moveRight = true;
animBoy.SetTrigger("goingRight");
}
// Are we touching the jump button?
if (guiJump.HitTest (t.position, Camera.main)) {
doJump = true;
}
}
// Did the touch end?
if (t.phase == TouchPhase.Ended)
{
// Stop all movement HOW CAN I CHECK WHICH TOUCH HAS BEEN ENDED???
doJump = moveLeft = moveRight = false;
animBoy.SetTrigger("idle");
}
}
}
How can i check which of my touch has been ended (or button released ) or can be done with sprites because guiTextures are changing because of mobile resolution.
Thanks in advance! :)
Comment
Your answer
Follow this Question
Related Questions
How to stop second finger from manipulating position of gui joystick 1 Answer
How to add multitouch? 1 Answer
when i drag my finger on mobile screen gameobject move left or right but not follow my finger 1 Answer
Swipe controls error "Cannot implicitly convert type 'UnityEngine.Touch' to 'Touch' " 1 Answer