Skip to content

A script that simplifies the detection of Touch actions in Unity.

Notifications You must be signed in to change notification settings

terresquall/TouchManager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project description

This is a repository of a WIP Unity Asset Store asset. The project is intended to contain and showcase a component called TouchManager, which is meant to simplify the complexities of touch detection in Unity behind message functions like OnTriggerEnter() or OnTriggerExit().

Setting up the Unity project

Drop this GitHub project into an existing Unity project and you are good to go.

Please note: This is not a Unity project by itself!

How to use

To use this, attach the TouchManager component to the Main Camera in the Scene. Once done, all GameObjects with colliders will detect the following events:

  • OnSwipeEnter(Touch t)
  • OnSwipeStay(Touch t)
  • OnSwipeExit(Touch t)
  • OnSwipeEnter2D(Touch t)
  • OnSwipeStay2D(Touch t)
  • OnSwipeExit(Touch t)
  • OnTouchTap(Touch t)
  • OnTouchHold(Touch t)
  • OnTouchUntap(Touch t)
  • OnTouchTap2D(Touch t)
  • OnTouchHold2D(Touch t)
  • OnTouchUntap2D(Touch t)

Each of these functions will receive the Touch object that caused the event.

Touch Manager properties

If you have multiple cameras on the Scene, you will need to attach a Touch Manager for each of them.

Credits

About

A script that simplifies the detection of Touch actions in Unity.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages