Interhaptics Mobile SDK
Setting up the Interhaptics Core SDK
This documentation concerns setting up the Interhaptics SDK for mobile development (Android/iOS) starting with version 1.1.0 (03.2023) which was overhauled to be aligned with the main SDK. For the older version renamed as legacy, please refer to the Interhaptics Mobile SDK (legacy) page.
The Interhaptics Core SDK can be installed via the Unity Package Manager as described in the Getting Started with the Unity SDK chapter.
Android: To set up correctly the project, verify that Project Settings -> Player -> Other Settings -> Scripting Backend is set to IL2CPP and set the Target Architecture as ARM64 if it is not checked. Uncheck ARMv7 if it is active (strongly recommended). For Android, set the Minimum API Level 23 (Android 6.0 Marshmallow).
iOS: An iPhone 8 or newer is needed to have haptic capabilities. Unity for MacOS is strongly recommended to make the XCode builds. The Target Device should be iPhone and the Target minimum iOS version should be at least 13.0.


Note: For Android phones that lack native amplitude control support, developers can use the GenericAndroidHapticAbstraction.AmplitudeThreshold parameter to adjust the intensity of haptic feedback. This parameter is an integer value that determines the strength of haptic feedback. It ranges from 0 to 255, inclusively, with 0 representing the minimum amplitude and 255 representing the maximum amplitude. Any value above the specified threshold will trigger vibration on the phone. When modified at runtime, the new threshold will only activate when playing a new haptic effect to the phone. If a haptic effect is currently playing, changing the amplitude threshold will have no immediate impact. Only when a new clip is transmitted, the updated threshold will be utilized.
// Can be modified to tune the experience
// Can be changed in runtime
public static int AmplitudeThreshold = 100;
Note: When working with iPhones, please be aware that the Unity project is responsible for generating the XCode project, which ultimately builds the app. It is strongly recommended to use the Unity macOS version (and not an Windows version) to build the XCode project.
Some DllNotFoundException: HAR assembly errors might appear in the Unity Editor console. These will not impact the building of the XCode project and should be ignored.
As of our testing, Interhaptics is confirmed to be compatible with XCode versions 14.3 and 15.0+. After you have signed in with your developer team, we recommend disabling the following settings for optimal performance:
- Target UnityFramework -- Enable Module Verifier
- Enable User Script Sandboxing
These settings are not required for Interhaptics functionality and can
potentially introduce compatibility issues. By unchecking them, you
ensure a smoother experience when building and running your app on iOS
devices.
The maximum length for a haptic effect on iOS is 30 seconds. For
anything longer, two or more haptic effects must be chained.



The following steps are for a very quick possible implementation which is explained more in detail in the Getting Started with Unity SDK chapter from this section.
Quick Mobile Integration Example
Interhaptics Unity SDK 1.1.0 -- 1.2.3
Create an empty GameObject with the HapticManager component, which can be set to be persistent if desired.

Interhaptics Unity SDK 1.3.0 +
Do not add the HapticManager component, as HapticManager.cs is not a MonoBehaviour class from this version on.
Create another GameObject with a HapticBodyPart component. Set the HapticBodyPart to Hand and Side to Global.

Create an empty GameObject with an EventHapticSource component and choose a haptic effect from the Haptic Effects folder.

Create a UI element to act as a trigger for haptic feedback. Add OnClick the EventHapticSource GameObject with the PlayEventVibration method.
