Using the Patchwork Drum Player Device
UEFN 41.20 introduced `Devices`. This short tutorial shows a working Verse example that uses it.
Introducing the Drum Player Device in Verse
Fortnite's Patchwork device set (introduced in UEFN 41.10) is full of devices you can reference directly in your Verse scripts: drum_player_device. This device lets you wire up a Drum Player placed in your UEFN level to custom gameplay logic written in Verse.
This tutorial shows the minimal setup needed to reference a drum_player_device from a creative_device, so you can start building on top of it.
How it works
drum_player_devicelives in theFortnite::Devices::Patchworknamespace, so you'll need to bring in/Fortnite.com/Devices/Patchworkwith ausingstatement.- It's declared as
<concrete><final>, meaning you can create editable references to it, but you cannot subclass it further. - It inherits from
patchwork_device, which is the base class shared by devices in the Patchwork family. - Just like any other device, you expose an instance of it in your creative device using an
@editablefield. This lets you drag-and-drop a Drum Player device from your level into the slot in the Fortnite Editor. - Once referenced, your Verse code can hold onto that device instance for later use as more Patchwork APIs become available on it.
The code
using { /Fortnite.com/Devices }
using { /Fortnite.com/Devices/Patchwork }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
# Demonstrates the drum_player_device from the Patchwork collection.
using_devices_example := class(creative_device):
@editable
Target : creative_prop = creative_prop{}
@editable
DrumPlayer : drum_player_device = drum_player_device{}
OnBegin<override>()<suspends>:void =
Print("Ready to use Devices")
Print("Drum Player device reference is set up and ready")
Try it yourself
- Create a new Verse device in UEFN and paste in the code above.
- Place a Drum Player device from the Patchwork device set into your level.
- Compile your Verse code so the
using_devices_exampledevice appears in your content browser. - Drag the
using_devices_exampledevice into your level, then select it and assign your placed Drum Player device to theDrumPlayerproperty in the Details panel. - Playtest your island and check the Verse output log — you should see both print messages confirming your device reference is wired up correctly.
From here, you're set up to start expanding your logic to interact with the Drum Player device as more of its API surface becomes available in future releases.
Turn this into a guided course
Add New in UEFN 41.20: Devices to your free study plan — we'll suggest related pages and stitch the lot into one compile-checked, self-guided lesson with worked examples and quizzes.
Original guide generated by Verse Island from the Verse/UEFN knowledge base, with references to the Epic Games sources above. Code is validated against the knowledge base.