- Home /
four simultaneous touch inputs in android
I want to write a script so that my scipt can handle four touch inputs at a time.Also when a touch is released, script should return name of the gameobject from which the touch is released so that appropriate action be taken against that gameobject.
Answer by frarees · Mar 30, 2014 at 11:13 AM
Use the Touch class.
In your Update
function check how many touches are being processed via Touch.tapCount
. Handling which object is being "touched" is something you have to do by yourself (raycast from camera to world, and get the collided GameObject. I name that process picking). Check the phase
of the touch to detect when it's finishing, in order to pick that object.
The documentation page I sent to you before has some examples that you should be checking. Like this one
Answer by ava4414 · Mar 30, 2014 at 07:42 PM
There one problem, not all devices support 4 touches, and the touch class doesnt make difference between touches, so you can get all touches and then only take care for the first 4