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?

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.

  • Thank you very much, however I found the answer here: answers.unity3d.com/questions/875535/…. – 000000000000000000000 Jun 12 '16 at 18:49
  • 1
    @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. – DMGregory Aug 25 '16 at 19:22

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.