Guide beginner compiles

Using the Patchwork Drum Player Device

UEFN 41.20 introduced `Devices`. This short tutorial shows a working Verse example that uses it.

Updated beginner Release Notes Code verified

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_device lives in the Fortnite::Devices::Patchwork namespace, so you'll need to bring in /Fortnite.com/Devices/Patchwork with a using statement.
  • 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 @editable field. 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

  1. Create a new Verse device in UEFN and paste in the code above.
  2. Place a Drum Player device from the Patchwork device set into your level.
  3. Compile your Verse code so the using_devices_example device appears in your content browser.
  4. Drag the using_devices_example device into your level, then select it and assign your placed Drum Player device to the DrumPlayer property in the Details panel.
  5. 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.

Comments

    Sign in to vote, comment, or suggest an edit. Sign in