Verse Library verse

01 Device

Activates and logs the position of a placed prefab when the game session begins.

verse-library/using-prehistoric-prefabs-in-fortnite-creative/01-device.verse

# This comment block shows how Verse thinks about
# a placed prefab device at runtime.
# In practice, you drag the prefab into the level in
# the UEFN editor — you do not spawn it in Verse code.
# The snippet below shows how a Verse manager device
# can hold a reference to a creative_prop that was
# placed in the editor, so you can move or query it.

using { /Fortnite.com/Devices }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }

# 1. Declare a manager device that lives in the World.
coliseum_manager := class(creative_device):

    # 2. The Prefab is represented here as a creative_prop.
    #    Drag your placed Coliseum prefab into this slot
    #    in the UEFN Details panel.
    # note: creative_prop is the closest real Verse type for
    #       a placed prop/prefab you reference from a device.
    @editable
    MyColiseum : creative_prop = creative_prop{}

    # 3. OnBegin runs when the game starts.
    #    We log the prefab's current world position so we
    #    know it loaded correctly — like giving the Entity
    #    a name tag so we can find it later.
    OnBegin<override>()<suspends> : void =
        MyColiseum.Show()   # Make sure the prefab is visible.
        Log("Coliseum is in the game! You can see it. You can walk around it.")

Comments

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