- Home /
GUITextures and Multi Touch
The root of my problem is the fact that I cannot seem to achieve multiple touches in a device build. Taken from Unity's ScriptReference:
// Prints number of fingers touching the screen
function Update () {
var fingerCount = 0;
for (var touch : Touch in Input.touches) {
if (touch.phase != TouchPhase.Ended && touch.phase != TouchPhase.Canceled)
fingerCount++;
}
if (fingerCount > 0)
print ("User has " + fingerCount + " finger(s) touching the screen");
}
Unity Remote properly prints out the number of touches on the screen. Once it's taken a step farther (actually built to the device), the touch count NEVER exceeds 1.
I hope there is someone who can enlighten me on why exactly I'm unable to get a correct print out.
Thanks!
Ah that would help - neither the iPhone 4 nor the iPad 2 worked.
Have you tried doing a Debug.Log(Input.touches.Length)? See how many there are in the array - there can be some strange things with touches on the device depending on frame rate.
Yea. The output looks very similar to the touch count. 1 seems to be my lucky number for this one.
Do you know whether or not changing the frame rate would be useful in this particular case? To the best of my knowledge it's still at the default value - I was playing with it before but had very little luck.
You could try disabling the Display Link option in the XCode project - then it uses a different method to process the events - but unless your framerate is very low it shouldn't always miss like it seems to be.
Answer by uhhhhhhh · Jul 26, 2012 at 07:28 PM
Just narrowed it down to a custom plugin. Doesn't make much sense why it was interrupting touch input - but removing ended up being a success.
Thanks again for the suggestions.
Your answer
Follow this Question
Related Questions
GUI texture touch input problem 1 Answer
GuiTexture (Touch button) unfollow camera! 1 Answer
GUI Texture Touch Android 2 Answers
Touch Input with GUI Texture 1 Answer