Guide
Using our Unity SDK Plugin, you can implement the haptic into your content made with Unity.
- Import SDK Plugin
- Link the Haptic App
- Add Prefab to Initialize
Prerequisite​
Before we start, make sure you have a haptic application(haptic app, for short) corresponding to your game, and the haptic app should contain at least one haptic event. By following this guide, You will link the haptic app to your game.
You can create and manage haptic apps in Portal, a web-based program. If you don't know about haptic app or don't have one, please visit Portal first and make your own haptic app. (Protip: Use template to make the app quickly)
Link process requires App ID and API Key which can be browsed in Portal. Go to your haptic app in Portal, move to "Settings" tab, and prepare App ID and API Key.
There is no API Key until you create it. Navigate to the "API Key" tab and click the "New" button to generate one.
Import SDK Plugin​
Get bHaptics Haptic Plugin in Unity Asset Store, and import the package into your Unity project.
For more information about importing the Unity package to your Unity project, follow the official Unity documentation.
Link the Haptic App​
-
In the toolbar, select "bHaptics" → "Developer Window".
-
Enter your App ID and API Key from Portal, then click "LINK" button.
noteYou can press "Forgot your App ID & API Key?" to visit Portal and retrieve the information.
-
After successful certification, the application will appear on bHaptics Developer Window.
Browse App in bHaptics Developer Window​
There are multiple tabs you can explore.
-
Home: View the sample guide, and information about your application.
-
Events: Browse and play the latest events you deployed from bHaptics developer portal.
-
Documentation: Browse the documents about the SDK(including this site!)
-
Latest Deployed Version: Check the version or refresh.
noteEnsure the version in the portal matches the version in the editor; if not, press refresh icon.
-
Unlink: Disconnet between the game and the haptic app.
Add Prefab for Initialization​
There is a prefab named "[bhaptics]" for initalizing the haptic environment. It should be instantiated before using haptic-related functions. We highly recommend to place it at the first scene.
- Go to your first scene.
- In the Project Window, Go to "Assets" → "Bhaptics" → "SDK2" → "Prefabs".
- Add "[bHaptics]" prefab into your scene.
The component in this prefab uses the common Unity Singleton pattern with DontDestroyOnLoad. You only need to place it in the first scene, but it is okay to place multiple places since duplicates are automatically destroyed.
Further Reading​
You're now ready to use the bHaptics haptic feature! Visit our Unity References page to play haptics in your game.
If you want to feel haptics right now, we provide a sample scene to explore the haptic events you can playtest. Go to "Assets" → "Bhaptics" → "SDK2" → "Examples" → "Scenes", and open "PlayParamSample" scene. You can play all haptic events with adjusting related parameters.