Skip to content
rafaelvaloto edited this page Sep 12, 2025 · 35 revisions

Windows Dualsense Unreal Documentation

🚀 Quick Starter Guide

This guide demonstrates how to use the features of the Windows Dualsense Unreal Plugin in your projects, covering two main approaches: a simple method for quick tests and a robust, scalable architecture for complete projects.

Approach 1: Quick Test (Direct Blueprint Call)

This is the easiest way to test the controller's effects. You can call the plugin's static functions directly from any Blueprint, such as the PlayerController or Character. This is ideal for prototyping and quickly testing features.

Step-by-step:

  1. Open the Blueprint: Open the Blueprint where you want to trigger the effect (e.g., your character's Blueprint).
  2. Find an Event: Choose an event to fire the function, such as an Input Action (button press) or the Event BeginPlay.
  3. Call the Plugin Function:
    • Right-click on the event graph and search for the plugin's functions. They are organized into two main categories: "Sony Gamepad" (for common features) and "DualSense Effects" (for DualSense-exclusive features).
    • Select the desired effect, such as Weapon, Resistance, or Galloping.
  4. Configure the Parameters:
    • Connect a Get Player Controller node, and from it, a Get Local Player Controller ID node to get the Controller Id.
    • Adjust the effect's other parameters, such as Strength, Position, and Hand, as needed.

Practical Example: Semi-Automatic Weapon Effect

The image below shows how to trigger the Weapon effect to simulate firing a weapon. The function is called directly, making the test immediate.

Example of Weapon Effect in Blueprint


Approach 2: Robust Architecture with a Centralized Subsystem

For larger, more organized projects, the best approach is to centralize your controller logic. This makes the code cleaner and easier to maintain, as your game logic doesn't need to directly reference the plugin. We will use a Game Instance Subsystem to act as a central hub for all game events that should produce a haptic effect.

The workflow is as follows: Any part of the game (character, weapon, etc.) -> Calls a generic game event on the Subsystem -> The Subsystem's Event translates this into a specific controller action.

Step 1: Create the Game Instance Subsystem

This Subsystem will exist for the entire duration of the game and will be our central manager.

  1. Right-click in the Content Browser, go to Blueprint Class and search for GameInstanceSubsystem.
  2. Name it BPS_MyGameInstance.
  3. Open the Subsystem and create Custom Events that represent game actions, not controller effects. This is key for abstraction.
    • Add a Custom Event and name it OnActiveWeaponChanged.
    • In its Details panel, add input parameters that describe the event, such as a reference to the PlayerController and the CurrentWeapon.
  4. Inside this event, you can add logic (like casting CurrentWeapon or checking its properties) to call the appropriate static plugin function. For example, a heavy weapon could trigger a strong Resistance effect, while a light weapon could trigger a quick vibration.

Example Implementation in the Subsystem:

Here is an example of an OnActiveWeaponChanged event inside your BPS_MyGameInstance Subsystem. It receives the new weapon and can then decide which haptic effect to play.

Example of Weapon and Automatic Gun Effect in Blueprint

Begin Object Class=/Script/BlueprintGraph.K2Node_CustomEvent Name="K2Node_CustomEvent_1"
   CustomFunctionName="OnActiveWeaponChanged"
   ...
   CustomProperties UserDefinedPin (PinName="Player Controller",PinType=(PinCategory="object",PinSubCategoryObject="/Script/CoreUObject.Class'/Script/Engine.PlayerController'"))
   CustomProperties UserDefinedPin (PinName="CurrentWeapon",PinType=(PinCategory="object",PinSubCategoryObject="/Script/Engine.BlueprintGeneratedClass'/Game/Variant_Shooter/Blueprints/Pickups/BP_ShooterWeaponBase.BP_ShooterWeaponBase_C'"))
End Object

Step 2: Store a Reference to the Subsystem (Best Practice)

To avoid getting the subsystem every time you need it, you should get it once and save it to a variable. The best place to do this is in the Event BeginPlay of your PlayerController or Character Blueprint.

  1. In your BP_ShooterCharacter Blueprint, create a new variable of type BPS_MyGameInstance and name it HapticManagerSubsystem.
  2. On Event BeginPlay, get the subsystem, cast it to BPS_MyGameInstance, and set your new variable.

Example in Character's BeginPlay: This logic gets the subsystem at the start of the game and saves it for easy access later.

Example in Character's Blueprint

Begin Object Class=/Script/BlueprintGraph.K2Node_DynamicCast Name="K2Node_DynamicCast_0"
   TargetType="/Script/Engine.BlueprintGeneratedClass'/Game/FirstPerson/Blueprints/BPS_MyGameInstance.BPS_MyGameInstance_C'"
   ...
   CustomProperties Pin (PinName="Object", ..., LinkedTo=(K2Node_CallFunction_0 ...),)
   CustomProperties Pin (PinName="AsBPS My Game Instance", ..., LinkedTo=(K2Node_VariableSet_5 ...),)
End Object

Step 3: Usage Example - Triggering an Event

Now that you have a reference to the Subsystem stored in a variable, you can easily call your custom events from anywhere.

For example, in your Character's weapon swap logic, you'll want to change the trigger effect to match the new weapon. To do this, simply fire the OnActiveWeaponChanged event from your Subsystem, passing the PlayerController and the CurrentWeapon as parameters. The Subsystem will then handle the rest.

Usage Example - Triggering an Event

Visual Flow:

graph TD
    A[Weapon Swap Logic in Character BP] --> B[Get BPS_MyGameInstance Variable];
    B --> C[Call Custom Event: OnActiveWeaponChanged];
Loading

Advantages of this Approach

  • True Decoupling: Your game logic only communicates with your BPS_MyGameInstance, not the plugin directly.
  • Optimized: Getting the subsystem reference only once at BeginPlay is more efficient than getting it on every event.
  • Maintainability: All haptic feedback logic is centralized, making it incredibly easy to manage, debug, and expand

Back to the Main Repository

Clone this wiki locally