I have a touch screen laptop (Lenovo IdeaPad Flex 15, Windows 10) but on Unity, if I run the code:
if (Input.touchSupported)
print("supported");
else
print("not supported");
It prints that it is not supported. I am trying to make Pong, but you control both paddles and try to get a high score. Here is the code for trying to work past the fact that no touches are ever seen as touches. The code is supposed to move the paddle up or down.
if (Input.GetMouseButton(0)) {
if (Input.mousePosition.x < Screen.width / 2)
{
//Begin Section: Touch left side
if (mousePos.y > transform.position.y)
{
yPos = gameObject.transform.position.y + (paddleSpeed * Time.deltaTime);
}
else
{
yPos = gameObject.transform.position.y - (paddleSpeed * Time.deltaTime);
}
//End of section
}
}
This works, the only problem is, the paddles have to move independently of each other. So I programmed the other paddle the same way. But, when I run the program and touch my screen with both fingers, the paddles freak out and don't work.
Question: I need a way to program touch support for both paddles. This can be answered in two ways: Either telling me how to program around not having touch support, or how to get Unity to realize I do have touch support
Any help with this would be hugely appreciated! Thanks!
Update: I forgot to add that I already tested the above code on my Android and it freaks out when you use two hands, otherwise it is flawless.
You could also download Unity Remote 4 for your Mobile phone. It really helped me a lot : http://docs.unity3d.com/Manual/UnityRemote4.html
edit:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With