README.md

TouchScript — multi-touch library for Unity

When working on a project for mobile devices or PCs with touch input you will soon require basic gestures like tap, pan, pinch and zoom — they are not hard to implement manually using Unity API or using a package from Asset Store. The hard part is to make these gestures work together, e.g. to have a button with a tap gesture placed on a zoomable window. This is where you will need TouchScript — it makes handling complex gesture interactions on any touch surface an effortless job.

Why TouchScript?

TouchScript abstracts touch and gesture logic from input methods and platforms. Your touch-related code will be the same everywhere.

Downloading the package

Your first TouchScript project

To test how TouchScript works, create an empty scene and drag two prefabs from TouchScript/Prefabs folder to the scene: TouchManager and Cursors. Press Play and click or touch (if your PC supports touch input) the Game View — you will see colored circles, pointer cursors.

Note: to simulate a second pointer you can hold Alt and click anywhere within the Game View.

You can make any GameObject react to touch input — just attach one of the scripts called Gestures to it. TouchScript ships with a few built-in Gestures which you can find in Component/TouchScript/Gestures menu. It is also possible to write your own gestures.

To test how built-in Gestures work, create an empty cube in the scene and attach a TransformGesture to it either from Component menu or Add Component button. Make the cube large enough to be able to touch it with two fingers. Attach another component called Transformer to the cube — this component listens to events from TransformGesture and applies translation, rotation and scaling to the GameObject.