Unity and games
This document describes how to get touches working in Unity applications and games with UPDD on Windows and macOS. It was not hard to get touches working using the UPDD driver and UPDD Commander's TUIO server together with Unity TouchScript in macOS.
Windows
On Windows it is not necessary to enable TUIO, as TouchScript supports native Windows touches. If UPDD Commander is configured to pass touches to Windows, or is not being used at all and the driver is processing touches, then Unity / TouchScript should receive the touches and allow the developer to process them. All you need to do is add TouchScript to your project from the Unity asset store.
macOS
TUIO is only necessary in macOS because macOS does not have its own native touch screen events. Unity does not support TUIO touches on its own, so you will also need to use a third party asset.
Here are the steps to get it working:
- Define your Unity application as a TUIO client in UPDD Commander.
- Go into the Unity asset store, and add "TouchScript" to your project (if you are not already using it). This is a free asset that adds a variety of multi-touch functionality to Unity, including reading touches from TUIO.
- To make sure it is working, open one of the test scenes it provides in the TouchScript / Examples folder, such as "RawInput". Before these scenes will work, you must enable TUIO:
- Pick the menu Window > TouchScript > Settings and make sure "Enable TUIO" is checked.
- In the scene hierarchy, select TouchManager, and add the component "TUIO Input" to it.
You should now be able to play the scene and see it react to your touches.
Delays in Unity and Cocos2D-X applications
Touches in Unity applications and games created with Cocos2D-X can be delayed on macOS because these applications answer UPDD Commander's UI element requests slowly. Why, and how to disable UI element detection (and Click nearest UI element) for such an application, is described in Touch delay and latency in Commander.