simple touch input test isn't working
Hi I am a new to unity3d and I am trying to detect the number of touch input in an android game but it doesn't working. I checked the code many time but nothing seems wrong. Am I missing something? It's a simple code.
void Update ()
{
bool supportsMultiTouch = Input.multiTouchEnabled;
print("MultiTouchSupport : " + supportsMultiTouch);
int nbTouches = Input.touchCount;
if(nbTouches >= 0){
print(nbTouches + " touch(es) detected");
for (int i = 0; i < nbTouches; i++)
{
touch = Input.GetTouch(i);
print("Touch index " + touch.fingerId + " detected at position " + touch.position);
}
}
}
Comment
Does it print the first sentence? Is the component attached to an active GameObject?
so you're saying you're not getting more than what... 0 touches? 1 touch?
that's weird... have you tried debugging touchCount in Update only? Just one line of code?
Your answer
![](https://koobas.hobune.stream/wayback/20220612041745im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How can i move just one object ? 0 Answers
Two finger tap causes jump bug 0 Answers
Android Controls 1 Answer
Jump by touch Unity C# 0 Answers
Player follow touch when holding down your finger on the screen (C#) 1 Answer