Guide for Unreal
Using our Unreal SDK Plugin, you can implement the haptic into your content made with Unreal.
- Import SDK Plugin
- Link the Haptic App
- Add Prefab to Initialize
- (Optional) Prepare for C++
Prerequisite
If you want to use haptic feature in your game, the haptic application should be linked to your game. Make sure you have a haptic application(haptic app, for short) corresponding to your game.
You can create and manage haptic apps in Developer Portal(Portal, for short), 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)
Prepare your haptic app
To link the haptic app to the game, the haptic app should meet these requirements. Go to your haptic app in the Portal, and check these requirements.
- Haptic app should contain at least one haptic event
- The event named
game_start
already exists, unless you manually removed it.
- The event named
- API Key should be generated
- There is no API Key until you generate it. Go to the "API Key" tab and click "New" button to generate one.
- Haptic app should be deployed
- If you see "Deploy Now" button on the top right, press it to deploy your haptic app. Otherwise, if you can see "Up to date", it means that the latest haptic app has already been deployed.
Get App ID & API Key
Link process requires App ID and API Key which can be browsed in the "Settings" tab. Go to the "Settings" tab, and check the App ID and API Key.
Import SDK Plugin
There are two ways to import the SDK plugin into your Unreal project.
- If your project's Unreal version is 5.0 - 5.4, you can get a plugin from Unreal Marketplace.
- If your project's Unreal version is 4.26 - 5.4, you can download the plugin files, and add them to your project.
- Using Unreal Marketplace (UE 5.0 - 5.4)
- Using Plugin Files (UE 4.26 - 5.4)
- Get bHaptics Plugin from Unreal Marketplace.
- Go to Epic Games Launcher to install plugin to engine.
- At the left, Select "Unreal Engine" tab.
- At the top, Select "Library" tab.
- Scroll down to Vault, and search "bhaptics".
- Find "bHapticsPlugin", and select "Install to Engine".
- Select your game engine version you want to use.
- Select "Install". The download will begin immediately.
noteFor more information about plugin in Unreal, visit official Unreal Documentation.
- Activate the plugin.
- Open the Unreal project which you want to use bHaptics.
- Open the Plugins window.
- In the toolbar, select "Settings".
- In the dropdown, select "Plugins". Then the Plugins window will appear.
- Activate "BhapticsPlugin".
- Search "bhaptics".
- Check "BhapticsPlugin" to activate.
- The warning will appear. Press "Restart Now". (Make sure you save your project first if you have any changes!)
- After restarting the editor, open the Plugins window again, and check that "BhapticsPlugin" is enabled.
Back up your project before you start.
It assumes that your Unreal project is using C++. If the project only uses Blueprints, you must create a C++ class and build your project before following these instructions.
If you want to use this method, but you previously installed the plugin from the Epic Games Launcher, remove the plugin from the engine before proceeding.
- Go to our official SDK page, and select the Unreal version of your project. The zipped plugin files will download immediately.
- Unzip the downloaded zip files. The folder named
BhapticsPlugin
will be created. - Go to the directory of your Unreal project. Then, place the
BhapticsPlugin
folder in thePlugins
folder of your Unreal project. The path should be[YourUEProjectName]/Plugins/BhapticsPlugin
.- If the
Plugins
folder doesn't exist in your project, create a new one. The location of these files must not be changed, so ensure they are placed correctly. - The folder should be located as follows. (Directory structure can vary depending on your project)
[YourUEProjectName]
├── Binaries
├── Config
├── Plugins
│ └── BhapticsPlugin
├── (...)
├── [YourUEProjectName].sln
└── [YourUEProjectName].uproject
- If the
- Right-click the
[YourUEProjectName].uproject
file and select "Generate Visual Studio Project Files" to regenerate the[YourUEProjectName].sln
file. - Open
[YourUEProjectName].sln
, right-click the project name in the Solution Explorer, and select "Rebuild" to compile the project source. - Open your Unreal project, and go to Plugin settings. Check that "BhapticsPlugin" in Haptic section is enabled.
Link the Haptic App
- Open the Project Settings.
- Go to bHaptics plugin settings.
- Put the App ID, API Key of your haptic app, and press "Link bHaptics" button. App ID and API key can be found in Portal.
- If the project is successfully synchronized with bHaptics Developer portal, you will receive following message BHAPTICS_SETTINGS_SUCCESS.
- Open [YourUEProjectName].sln, right-click the project name in the Solution Explorer, and select "Rebuild" to compile the project source.
- Open your Unreal project, and go to Plugin settings. Check that "BhapticsPlugin" in Haptic section is enabled.
Set Haptic Environment
Before using haptic-related functions, you must initialize the haptic environment. The initialization should be made at the beginning of the game. Also, you should destroy the haptic environment when the game is ended.
We provide both Blueprint and C++ methods for these functionalities.
- Blueprint
- Initalize: Call "Initialize bHaptics" Node
- Destroy: Call "Destroy bHaptics" Node
- C++
- Initalize: Invoke
UBhapticsSDK2::Initialize()
Function - Destroy: Invoke
UBhapticsSDK2::Destroy()
Function
- Initalize: Invoke
Also, you must notice that:
- You can initialize multiple times. This will not cause any efficiency problem.
- You MUST DESTROY at the last level where the program ends, and you must do it ONLY ONCE. It can cause crashes if you don't destroy or destroy more than once.
We offer two options. Feel free to choose the one that suits your needs.
- Via GameInstance (Recommended)
- Via Level Blueprint
Via GameInstance
The game instance is instantiated on engine launch and remains active until the engine shuts down.
"Gameplay Framework" — Unreal Documentation
- Create new Blueprint Class inherit from "GameInstance".
- Name it as you want, and open its Event Graph.
- Setup the Event Graph, and compile/save.
- Initialize: Connect "Initialize bHaptics" after "Event Init".
- Destroy: Connect "Destroy bHaptics" after "Event Shutdown".
- Go to Project Settings → Project → Maps & Modes, and set Game Instance Class as what you've just made.
Via Level Blueprint
- Open the Level Blueprint.
- Setup the Event Graph, and compile/save.
- Initialize: Connect "Initialize bHaptics" after "Event BeginPlay".
- Destroy: Connect "Destroy bHaptics" after "Event End Play".
(Optional) Prepare for C++
If you're using C++ in your Unreal project, there are some additional required processes.
- Move to
Source/[YourGameName]/[YourGameName].Build.cs
and add dependency.Source/[YourGameName]/[YourGameName].Build.cs// Add Dependency
PrivateDependencyModuleNames.Add("BhapticsPlugin");
// Or Using AddRange
PrivateDependencyModuleNames.AddRange(new string[] { "BhapticsPlugin" });noteAfter you modify the
Build.cs
file, you must regenerate the project files, and rebuild the engine.- Regenerate the project files: Go to your Unreal project in the file explorer, right-click the
[YourUEProjectName].uproject
file, and select "Generate Visual Studio Project Files". - Rebuild the engine: Open
[YourUEProjectName].sln
, right-click the project name in the Solution Explorer, and select "Rebuild".
- Regenerate the project files: Go to your Unreal project in the file explorer, right-click the
- Include
"BhapticsSDK2.h"
header in your C++ script which uses the haptic features.#include "CppGameModeBase.h"
#include "BhapticsSDK2.h"
void CppGameModeBase::BeginPlay()
{
Super::BeginPlay();
UBhapticsSDK2::Initialize();
}
Further Reading
You're now ready to use the bHaptics haptic feature! Visit our Unreal Reference page to play haptics in your game.
Troubleshooting
If you can't find the module, please refer to this page.