Reference Devices compiles

firefly_spawner_device: Collectible Fireflies That Drive Game Logic

The `firefly_spawner_device` lets you scatter glowing collectible fireflies across your island and react in Verse whenever a player grabs one. Whether you're building a scavenger hunt, a score-based collection challenge, or a puzzle where gathering fireflies unlocks a door, this device gives you the hooks you need. In this article you'll learn every method and event on the device and wire them into a real game scenario.

Updated Examples verified on the live UEFN compiler
Watch the Knotfirefly_spawner_device in ~90 seconds.

Overview

The firefly_spawner_device spawns interactive fireflies that players can walk through to collect. It solves a common creative problem: you want a lightweight, visually appealing collectible that doesn't require an item in the player's inventory. Fireflies simply exist in the world, glow, and disappear when touched — and your Verse code is notified immediately.

Reach for this device when you need:

  • Scavenger hunts — scatter fireflies around a map and track how many each player collects.
  • Score triggers — award points or unlock areas each time a firefly is collected.
  • Timed challenges — enable the spawner at round start, disable it when time expires, and reset the respawn count for the next round.
  • Puzzle gates — collect N fireflies to open a vault door.

The device exposes three methods (Enable, Disable, ResetRespawnCount) and one event (OnFirefliesCollected) — a small, focused surface that is easy to master.

API Reference

firefly_spawner_device

Used to spawn fireflies that can be collected by agents.

Full public surface, resolved verbatim from the live Epic digest (Fortnite.digest.verse).

firefly_spawner_device<public> := class<concrete><final>(creative_device_base):

Events (subscribe a handler to react):

Event Signature Description
OnFirefliesCollected OnFirefliesCollected<public>:listenable(agent) Signaled when a firefly is collected. Sends the agent collected the firefly.

Methods (call these to make the device act):

Method Signature Description
Enable Enable<public>():void Enables this device.
Disable Disable<public>():void Disables this device.
ResetRespawnCount ResetRespawnCount<public>():void Resets respawn count.

Walkthrough

Scenario: Firefly Vault — Collect 3 to Open the Door

A player enters an arena. Three firefly spawners are placed around the room. Each time the player collects a firefly a counter increments. When the counter reaches 3, a mutator_zone_device is disabled (acting as the vault door barrier) and all remaining spawners are disabled so no extras can be collected. At round reset the spawners are re-enabled and the count resets.

Setup in UEFN editor:

  1. Place three Firefly Spawner devices and name them FireflySpawner1, FireflySpawner2, FireflySpawner3.
  2. Place a Mutator Zone device named VaultBarrier (set it to block players).
  3. Place a Trigger device named ResetTrigger (players step on it to restart).
  4. Create a Verse device, assign all four references in the Details panel.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

firefly_vault_manager := class(creative_device):

    # --- Editable references wired up in the UEFN Details panel ---
    @editable FireflySpawner1 : firefly_spawner_device = firefly_spawner_device{}
    @editable FireflySpawner2 : firefly_spawner_device = firefly_spawner_device{}
    @editable FireflySpawner3 : firefly_spawner_device = firefly_spawner_device{}

    # A mutator zone that blocks the vault entrance — we Disable it to "open" the door
    @editable VaultBarrier : mutator_zone_device = mutator_zone_device{}

    # A trigger the host steps on to reset the puzzle for the next round
    @editable ResetTrigger : trigger_device = trigger_device{}

    # Mutable collection counter
    var CollectedCount : int = 0
    # How many fireflies are needed to open the vault
    RequiredCount : int = 3

    OnBegin<override>()<suspends> : void =
        # Subscribe all three spawners to the same handler
        FireflySpawner1.OnFirefliesCollected.Subscribe(OnFireflyCollected)
        FireflySpawner2.OnFirefliesCollected.Subscribe(OnFireflyCollected)
        FireflySpawner3.OnFirefliesCollected.Subscribe(OnFireflyCollected)

        # Subscribe to the reset trigger
        ResetTrigger.TriggeredEvent.Subscribe(OnReset)

        # Make sure everything starts enabled
        FireflySpawner1.Enable()
        FireflySpawner2.Enable()
        FireflySpawner3.Enable()

    # Called every time ANY of the three spawners signals a collection
    # OnFirefliesCollected sends an `agent`, so the handler receives `agent` directly
    OnFireflyCollected(Collector : agent) : void =
        set CollectedCount += 1

        if (CollectedCount >= RequiredCount):
            # Vault opens — disable the barrier zone
            VaultBarrier.Disable()

            # Stop any remaining fireflies from being collected
            FireflySpawner1.Disable()
            FireflySpawner2.Disable()
            FireflySpawner3.Disable()

    # Called when the reset trigger fires — restores the puzzle to its initial state
    # TriggeredEvent sends ?agent, so we accept that signature
    OnReset(Agent : ?agent) : void =
        set CollectedCount = 0

        # Re-enable the vault barrier
        VaultBarrier.Enable()

        # Reset each spawner's respawn budget and re-enable them
        FireflySpawner1.ResetRespawnCount()
        FireflySpawner2.ResetRespawnCount()
        FireflySpawner3.ResetRespawnCount()

        FireflySpawner1.Enable()
        FireflySpawner2.Enable()
        FireflySpawner3.Enable()

Line-by-line highlights:

Lines What's happening
@editable fields Every device reference must be an @editable field — you cannot call methods on a bare identifier.
OnFirefliesCollected.Subscribe(OnFireflyCollected) Hooks the event. The handler receives agent directly (not ?agent) because OnFirefliesCollected is typed listenable(agent).
set CollectedCount += 1 Verse requires set to mutate a var.
VaultBarrier.Disable() Disabling the mutator zone removes the barrier — the vault is now open.
FireflySpawnerX.Disable() Prevents further collection once the goal is reached.
ResetRespawnCount() Clears the internal spawn budget so fireflies can appear again next round.
FireflySpawnerX.Enable() Re-activates the spawner after the reset.

Common patterns

Pattern 1 — Enable / Disable on a timed round

Only allow firefly collection during a 30-second window, then shut the spawners off automatically.

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

firefly_timed_round := class(creative_device):

    @editable Spawner : firefly_spawner_device = firefly_spawner_device{}
    RoundDurationSeconds : float = 30.0

    OnBegin<override>()<suspends> : void =
        # Spawner starts disabled in the editor — Enable kicks off the round
        Spawner.Enable()

        # Wait for the round window to expire
        Sleep(RoundDurationSeconds)

        # Time's up — no more collecting
        Spawner.Disable()

Key point: Enable() and Disable() are synchronous void calls — no await needed. Sleep() suspends the coroutine without blocking other game logic.


Pattern 2 — Track per-player score with OnFirefliesCollected

Award score manager points every time a specific player collects a firefly.

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Game }

firefly_score_tracker := class(creative_device):

    @editable Spawner      : firefly_spawner_device = firefly_spawner_device{}
    @editable ScoreManager : score_manager_device   = score_manager_device{}

    OnBegin<override>()<suspends> : void =
        Spawner.OnFirefliesCollected.Subscribe(OnCollected)
        Spawner.Enable()

    OnCollected(Collector : agent) : void =
        # Award 1 point to whichever agent grabbed the firefly
        ScoreManager.Activate(Collector)

Key point: OnFirefliesCollected delivers the collecting agent directly — no unwrapping required. Pass it straight to ScoreManager.Activate.


Pattern 3 — ResetRespawnCount between waves

In a wave-based game, reset the firefly budget at the start of each new wave so the spawner doesn't run dry.

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

firefly_wave_manager := class(creative_device):

    @editable Spawner        : firefly_spawner_device = firefly_spawner_device{}
    @editable WaveTimer      : timer_device           = timer_device{}
    WaveDuration             : float = 60.0
    TotalWaves               : int   = 3

    OnBegin<override>()<suspends> : void =
        var Wave : int = 0
        loop:
            if (Wave >= TotalWaves):
                break

            # Fresh respawn budget for this wave
            Spawner.ResetRespawnCount()
            Spawner.Enable()

            Sleep(WaveDuration)

            Spawner.Disable()
            set Wave += 1

Key point: ResetRespawnCount() resets the internal counter that the device uses to honour the Max Respawn Count property you set in the editor. Without this call, the spawner can silently stop producing fireflies mid-game once the cap is hit.

Gotchas

1. Always use @editable fields — never bare identifiers

You cannot write firefly_spawner_device{}.Enable() inline. Every device you want to call methods on must be declared as an @editable field inside your creative_device class and wired up in the UEFN Details panel. A bare firefly_spawner_device{} is a default-constructed stub with no connection to the placed device in your level.

2. OnFirefliesCollected sends agent, not ?agent

Unlike some device events (e.g. trigger_device.TriggeredEvent) which send ?agent, OnFirefliesCollected is typed listenable(agent). Your handler signature must be (Collector : agent) : voidno optional unwrap needed. Trying to match it with ?agent will cause a type mismatch at compile time.

3. ResetRespawnCount does not re-enable the spawner

Calling ResetRespawnCount() only resets the internal spawn budget counter. If the device was previously Disable()d you must also call Enable() afterwards, or fireflies will never appear.

4. Disabling does not destroy already-spawned fireflies

Disable() prevents new fireflies from spawning but does not instantly remove fireflies that are already floating in the world. Players may still collect a firefly for a brief window after you call Disable(). Account for this in your collection logic (e.g. guard with a flag or clamp your counter).

5. The device's Max Respawn Count editor property caps total spawns

If you set Max Respawn Count to a finite value in the editor, the spawner will stop producing fireflies once that limit is reached — even if the device is still enabled. Call ResetRespawnCount() at the start of each round or wave to restore the budget. If you want unlimited fireflies, set the property to 0 (unlimited) in the editor.

6. No localized text needed here

None of the firefly_spawner_device methods accept a message parameter, so you don't need the <localizes> pattern for this device. If you pair it with a HUD Message device to display collection feedback, remember that message parameters require a <localizes> helper function — raw strings are not accepted.

Device Settings & Options

The firefly_spawner_device User Options panel in the UEFN editor — every setting you can tune.

Firefly Spawner Device settings and options panel in the UEFN editor — Total Spawn Limit, Time to Collect
Firefly Spawner Device — User Options in the UEFN editor: Total Spawn Limit, Time to Collect
⚙️ Settings on this device (2)

Setting names read from the panel above — may be partial; the screenshots are the source of truth.

Total Spawn Limit
Time to Collect

Build your own lesson with firefly_spawner_device

Generate a personalized, step-by-step lesson plan built around this object — grounded in this exact reference and our compile-verified knowledge base.

Build a lesson →