How can I make a script to Touch on mobile screen? | Sololearn: Learn to code for FREE!

+1

How can I make a script to Touch on mobile screen?

Can anyone tell me how to make a script in unity to touch on mobile screen?

6/20/2019 12:14:03 PM

Piyush Duggal

1 Answer

New Answer

+2

Check out the example provided in Unity's API on Input.getTouch https://docs.unity3d.com/ScriptReference/Input.GetTouch.html There is a Touch struct that handles device screen touches. Input.touchCount -> Returns the number of 'touches' on the screen (finger or stylus). Then, Input.getTouch, gives us that Touch struct. The Touch struct has attributes like the position, angle, action (is it moving?) Etc.. on the screen. Touch struct: https://docs.unity3d.com/ScriptReference/Touch.html