- Home /
How do you determine if the screen is being touched
I know this must be a stupid question, sorry. But I don't know what to use that would be an equivalent of Input.GetButton ("Fire1") with touch instead of right clicking.
Answer by Jerdak · Aug 10, 2012 at 08:19 PM
You want Input.touches
thanks, it looks helpful but I'm still having a problem. I tried using: for (var touch : Touch in Input.touches) { if(touch.phase != TouchPhase.Ended && touch.phase != TouchPhase.Canceled)
Ins$$anonymous$$d of if(Input.GetButton("Fire1"))
But this does not seem to work once I build and run. Any ideas what I'm doing wrong?
If you want to know if the screen is touched, just test for when number of Input.touches.length = 0. If 0, no touch, if not zero, touch.
Great. If it does how about accepting the answer. I don't normally pander but you have 5 questions asked and no accepts.
Your answer