How can I make a script to Touch on mobile screen? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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?

20th Jun 2019, 12:14 PM
Piyush Duggal
Piyush Duggal - avatar
1 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
25th Jun 2019, 10:28 PM
Rrestoring faith
Rrestoring faith - avatar