-
Notifications
You must be signed in to change notification settings - Fork 12
Example Project: Arena Shooter Tutorial
This example project is a basic arena shooter game built in Unreal Engine 5.6. It serves as a hands-on lab to demonstrate the features of the Windows Dualsense Unreal plugin in a real-world scenario.
Before you begin, please ensure you have the following:
- Unreal Engine 5.6 installed.
- The Windows Dualsense Unreal plugin installed either in the engine or in the project.
- The Shooter Arena example project downloaded.
Note: Please download the updated version of the example project to follow this tutorial.
- Extract the example project files to a location on your computer.
-
Open the
.uprojectfile from the project folder. The Unreal Engine editor will launch. - Wait for the shaders to compile if this is the first time you are opening the project.
To keep the project organized and easy to manage, all core DualSense logic is centralized in a single Blueprint: the Game Instance.
Think of the Game Instance as the central command hub 📡 for the controller's features. Because the Game Instance persists for the entire game session (even between levels), any Blueprint (like the Player, a Weapon, or the UI) can easily communicate with it to trigger controller effects. This avoids complex direct references and keeps the code clean.
You can find this central hub Blueprint here:
Content/Variant_Shooter/Blueprints/BPS_ShooterGameInstance
Inside the Event Graph of BPS_ShooterGameInstance, you will find the custom events that drive all the controller's functionality:
-
OnActiveWeaponChanged- Purpose: This event is called whenever the player equips a new weapon. It's responsible for querying the weapon's type and setting the correct Adaptive Trigger effect (e.g., a heavy trigger for a grenade launcher, a sharp click for a rifle).
-
Inputs:
Player Controller,Weapon.

-
OnSettingDefaultDualSense- Purpose: This event resets the controller to a neutral or default state. It's useful for when the player enters a menu, un-equips a weapon, or respawns, ensuring no lingering trigger effects are active.
-
Inputs:
Player Controller.

-
OnSignOfDamage- Purpose: Fired whenever the player takes damage. This event handles playing a Haptic Feedback effect to give the player a physical sensation of being hit. It also updates the Lightbar Color based on the player's remaining health.
-
Inputs:
Player Controller(namedPlayerin the event).

By using this event-driven approach in the Game Instance, the system is highly decoupled. The Character Blueprint doesn't need to know the specifics of a trigger effect; it just tells the Game Instance "I took damage," and the Game Instance handles the rest. This makes the code much cleaner and easier to expand in the future.
While the GameInstance is the command hub, the BP_ShooterCharacter is the one that listens for player actions and game events. It's the "instigator" that tells the Game Instance when to act.
You can find the character Blueprint here: Content/Variant_Shooter/Blueprints/BP_ShooterCharacter
Inside its Event Graph, you will see how player actions are captured and then used to call the events in the Game Instance.
-
Event:
IA_SwapWeapon (Triggered) - Role: This Enhanced Input event fires when the player presses the button to change their weapon.
-
Logic Flow: Inside this event, the character runs its internal logic to switch the active weapon. The final step is to get a reference to the
GameInstanceand call theOnActiveWeaponChangedevent, passing along thePlayer Controllerand a reference to the newly equipped weapon. This tells the command hub to update the controller's adaptive trigger effect.

-
Event:
Event ReceiveAnyDamage - Role: This is a built-in engine event that automatically fires whenever the character is damaged by any source.
-
Logic Flow: After the game applies damage to the character's health, a call is made to the
GameInstance'sOnSignOfDamageevent. This signals the command hub to play the damage haptics and update the lightbar color based on the character's new health value.

-
Event:
IA_Shoot (Triggered) - Role: This input event handles the logic for firing the weapon.
-
Logic Flow: This event works in perfect sync with the adaptive trigger effect that was set by
OnActiveWeaponChanged. The logic inside reads theAction Valuefrom the trigger (how far it's being pulled) to ensure the weapon only fires when the player overcomes the trigger's pre-set resistance point (for example, the "click" in a weapon effect). This creates a seamless connection between the physical feel of the controller and the in-game action, a core feature of the DualSense controller.
