TOUCH Development Kit

Using Ultrahaptics with the Unity® Game Engine

1082 views 26/04/2017 22/03/2018 D Fee 3

Bring Ultrahaptics’ mid-air, haptics technology to your Unity® developed games and VR applications.

This article shows you the steps needed to get you started with Ultrahaptics and Unity®.

Add the Ultrahaptics API to Unity®

  • Download and unpack the latest Ultrahaptics SDK to your working folder.
  • Install the SDK as normal
  • You can either double-click on the *.unitypackagefile from the Ultrahaptics SDK’s ./Libraries/Unity3D folder or, from within Unity®, right-click in the Project window and select ‘Import Package -> Custom Package’, select the *.unitypackage file and open.
  • This will open an import dialog box as shown (this may differ slightly in the Unity® package for Mac OS). Select all and click ‘Import’:

Once imported into your project, you will be able to use the Ultrahaptics C# API in any script files.

Good to know

The C# API is the same as the C++ version, the main exception being that everything is under the Ultrahaptics namespace. This means that, where C++ classes are nested in namespaces, in C# the namespace name is prefixed to the class name:

In C++


In C#


In addition, in cases where a set of objects must be provided, for example in AmplitudeModulationEmitter.update(…), these accept standard .NET collections (see the examples below).

Adding the Leap Motion asset

Unity® applications requiring hand tracking capabilities, such as the Ultrahaptics example below, will need the Leap Motion® SDK and Unity® core asset.


Windows users can use either Leap Motion®’s V2 or Orion SDKs [1]. For developing VR/AR applications, we recommend the Leap Motion® Orion SDK and the Unity® Core Asset here. The Orion Unity® Core Asset can be added as above.

Leap Motion® V2 Unity® Asset

Mac OS users will need to install the Leap Motion® V2 SDK and V2 compatible assets from here. The original Leap Motion® Unity® demo pack has been removed from Unity’s Asset Store, but you can find the V2 assets here. This is a Unity® project with a full suite of demos and cross-platform libraries. When first opening, you may be prompted to update for the latest version of Unity® – accept and continue. You can then create a separate .unitypackage file by exporting the project (right-click in the Project explorer, select ‘All’ and click ‘Export’). This can be included in any Unity® project alongside your Ultrahaptics asset.

To start using Leap Motion® in your game, drag and drop a HandController prefab into your hierarchy.

Ultrahaptics Example Scripts

You can find example Unity® scripts in the SDK’s Examples folder [2]:

  • Unity_AMFocus.cs – Creates a fixed focal point above the array.
  • Unity_AMHandTracking.cs – Track the hand and create a focal point at the palm.

These are implemented as Unity® “MonoBehaviour” classes, allowing them to be used as “Behaviour Components” and attached to Unity® objects. Unity® provides plenty of scripting documentation and tutorials on its website.

Add either of these scripts to any Game Object by adding a Script component and dragging and dropping the script from the Project explorer onto the ‘Script’ field in the Inspector.

Ultrahaptics Unity Script

Refer to our C++ Examples for additional information on using hand tracking and Time Point Streaming.

[1] Note, the Ultrahaptics Demo Suite is not compatible with Leap Motion® Orion. To use the demo, install Leap Motion® V2.

[2] In older versions of the SDK, pre v2.2.2, the class names may need to be changed to match the filename (or vice versa) to work with newer versions of Unity.


Was this helpful?