Verse Library verse

01 Device

Monitors creature spawner events to confirm cloth-equipped characters have successfully loaded.

verse-library/creating-clothing-assets-for-unreal-editor-for-fortnite-using-unreal-engine/01-device.verse

# In UEFN, characters are fort_character instances obtained from agents.
# Clothing attachment is handled in Blueprints/UE5 before import; Verse
# manages gameplay logic around those pre-configured assets.
# This snippet shows how a Verse device would reference a pre-built
# MetaHuman (spawned via a creature_spawner_device) and confirm the
# cloth asset is live by checking the character's validity.

using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# A device that watches for a character spawn and logs confirmation
# that the cloth-configured MetaHuman is active in the scene.
cloth_watcher_device := class(creative_device):

    # Wire this to a creature_spawner_device in the UEFN editor.
    @editable
    MetaHumanSpawner : creature_spawner_device = creature_spawner_device{}

    OnBegin<override>()<suspends> : void =
        # Wait for the spawner to produce a character, then verify it.
        MetaHumanSpawner.SpawnedEvent.Await()
        Print("MetaHuman with Chaos Cloth jacket is now active in the scene.")
        # NOTE: Parent-child cloth attachment is set up in UE5 before import.
        # The Chaos Cloth component runs automatically each frame on that asset;
        # no further Verse calls are needed to start the simulation.

Comments

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