- Home /
Problem with multi-touch from android
Hi guys I have this problem when compiling my application for Android (input). I have two conditions that activate with the click on the right or left side of the object. If I click together on the one and the other there is a reset condition. When I try the app on the phone he recognizes only the first touch and does not recognize me the second, so if I press A without releasing and I also press B instead of going to C he stays on A. Maybe it is to enable the multitouch or not good Input. GetmousebuttonDown for the phone? On unity it work fine, and i test it enabled the boolean together.
Any suggestion?
Thank you enter code here
if (Input.GetMouseButtonDown(0))
{
if (Input.mousePosition.x > playerScreenPoint.x)
{
//Condition A
destra = true;
sinistra = false;
}
else if (Input.mousePosition.x < playerScreenPoint.x)
{
//Condition B
sinistra = true;
destra = false;
}
}
Answer by Tsaras · Apr 18, 2019 at 03:23 PM
Unity has a system for handling touches for mobile. GetMouseButtonDown is actually just a hackish way of having code work for both the pc mouse and mobile at the same time but it just handles a single touch.
Read more about Touch. In effect you can get detailed information about every touch that is happening, including their current state, delta movement from previous frame etc