- Home /
Why can't I press both my touch controls at the same time?
foreach (Touch touch in Input.touches){
if(leftBounds.Contains(touch.position)){
GameManager.left_touch_count ++;
}
if(rightBounds.Contains(touch.position)){
GameManager.right_touch_count ++;
}
}
So this works when I hold the left side of the screen, the left_touch_count goes up, but if I keep it held down then hold down the right side, the right_touch_count does not go up. Same thing vise versa.
Answer by MD_Reptile · May 20, 2014 at 06:44 PM
http://unity3d.com/learn/tutorials/modules/beginner/platform-specific/multitouch-input
Check out that, and make sure you have MultiTouch flag enabled, I forget the exact syntax sorry.
Touch[] myTouches = Input.touches;
for(int i = 0; i < Input.touchCount; i++){
if(leftBounds.Contains(myTouches[i].position)){
Game$$anonymous$$anager.left_count ++;
this still didnt work. same as my other code only 1 at a time works.
Try this ins$$anonymous$$d:
private Touch[] myTouches;
void Start()
{
Input.multiTouchEnabled = true;
}
void Update()
{
myTouches = Input.touches;
for (int i = 0; i < myTouches.Length; i++)
{
if(leftBounds.Contains(myTouches[i].position))
{
Game$$anonymous$$anager.left_touch_count ++;
}
if(rightBounds.Contains(myTouches[i].position))
{
Game$$anonymous$$anager.right_touch_count ++;
}
}
}
What happens when you use this?
Your answer
Follow this Question
Related Questions
Multiple Touch Drag iOS 0 Answers
Touch joystick tutorials ? 0 Answers
Best way to get to get touch inputs? 1 Answer
How to fix this problem? ios touch screen? 1 Answer
Way to detect and get last/latest TOUCH 5 Answers