Assigning Haptic Clips to Game Objects
🔥NOTE: The Studio plug-in for Unity is currently in beta and under development. Information on this page is subject to change.
Haptic clips are created with either the Studio desktop app or the Studio web app. A haptic clip contains high-definition, device-agnostic haptic data that the Studio plug-in for Unity uses to create an optimal haptic effect on playback devices.
The Studio plug-in for Unity implements haptics in a similar fashion to Unity’s own audio system whereby Haptic Source
components are placed onto game objects and assigned various haptic clips taken from the games assets, and those haptic effects generated by the Haptic Source
components are then received by the Haptic Receiver
component typically attached to the Main Camera.
Adding Haptic Clips to the Project
Any haptic clip that you wish to use in your Unity application must first be added to the project. Specifically, the haptic clips (files ending with the extension .haptic
) must be added to the Assets
folder (or a sub-folder of your choosing) in the project. You can either directly drag haptic clips to this folder in Finder/Explorer, or you can drag them into the Unity Project Explorer.
Assigning a Haptic Source to a Game Object
-
Click on a
GameObject
in the scene hierarchy to which you want to assign a haptic clip: -
In the Inspector, click “Add Component”:
-
Type “haptic” in the search box and select
Haptic Source
from the list: -
In the inspector for this component, assign a haptic clip either by dragging one from the Project Window, or by clicking the small circle icon to the right of the Inspector property and selecting a clip from the list:
Assigning playback priority to a Haptic Source
-
Check the inspector for the
Haptic Source
you want to change the playback priority. -
Drag the slider to set a priority value from 0 (Highest priority) to 256 (Lowest priority). By default, a
Haptic Source
priority is set to 128, just like anAudio Source
.