Interhaptics XR SDK (Open XR)
In this section we will show step by step how to add haptic effects to play on a Unity game using an OpenXR compatible headset and controllers. An example scene and scripts are already provided in the Interhaptics Core SDK and can be found in the Interhaptics Core SDK/Assets/Scenes/SampleScene_XR.unity path.
Step 1: Setting up the Interhaptics Core SDK
The Interhaptics Core SDK can be installed via the Unity Package Manager as described in the documentation.
Step 2: Setting up Open XR environment
Open Unity Player Settings and navigate to the XR Plugin Management tab. If it is not already installed, set up the XR Plugin Management. Select the "PC" or "Android" platform and observe the available build targets. Click on OpenXR and wait for the appropriate OpenXR plugin to load.
Note: Certain settings unrelated to OpenXR, such as adjusting the color space to Linear and selecting the ARM 64 build architecture, may be required when building for standalone headsets like the Meta Quest or Pico Neo. However, these settings are not covered in this documentation.

When prompted, install the new input system package by selecting "Yes" and allowing Unity to restart.

In the OpenXR subtab, locate the "Interaction Profiles" section and add the profiles for the controllers being used.
With the OpenXR environment set up, the application can now be built across various XR platforms, generating the desired inputs and outputs from and on the controllers.

Step 3: Adding GameObjects for Custom Haptics
- Create an empty GameObject for the HapticManager, which can be set to be persistent if desired.
- Add HapticBodyPart components to the XR Rig, one for each controller. Set the Body Part to Hand and the correct orientation.
- Create a normal GameObject, such as a cube, to act as a trigger for haptic feedback.
- Add a SpatialHapticSource component to the trigger GameObject, where offsets for Haptic Effect can be set (e.g. a 2-second delay for vibrations).

Step 4: Adding Haptic Effects
- The Interhaptics SDK package includes over 30 haptic effects with accompanying audio, which can be selected for use.
- Custom haptic effects created with Haptic Composer can also be imported and used.
- Press Play in Unity and touch the collider to trigger haptic feedback.
Troubleshooting:
- If no haptics is playing, check if the selected runtime supports haptics through OpenXR.
- If there is a conflict with XInput, remove the XInput folder from the Interhaptics/Runtime/Platforms directory.