0
\$\begingroup\$

For my Unity game, I want a touch surface (UI Panel). I started implementing a MonoBehavious that should handle touch-started, touch-ended, touch-moved/dragged and double-tap with custom methods.

I read some forum posts and the scripting documentation, but I don't understand how have to do this.

Which base-class do I have to use? What methods should be implemented/ overridden?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

Unity's standard UI elements respond to both touch inputs and mouse inputs.

If you want to implement custom events that trigger on touch, use the Input class. For instance, Input.touches returns all the touches that are currently happening at that instant.

\$\endgroup\$
2
  • \$\begingroup\$ Thank you very much, however I found the answer here: answers.unity3d.com/questions/875535/…. \$\endgroup\$
    – user67808
    Jun 12, 2016 at 18:49
  • 1
    \$\begingroup\$ @000000000000000000000 To help others with the same question find the solution, it's worth posting a description as an answer on this question, and marking it accepted. That way, even if the answers.unity3d link breaks in the future, the information will still be accessible. \$\endgroup\$
    – DMGregory
    Aug 25, 2016 at 19:22

You must log in to answer this question.