Verse Library verse

01 Fragment

Creates and attaches a custom modal widget to players for interactive menu selection.

verse-library/making-widgets-interactable-in-unreal-editor-for-fortnite/01-fragment.verse

using { /Fortnite.com/Devices }
using { /UnrealEngine.com/Temporary/Systems/World }
using { /Verse.org/Simulation }

# 1. Define our Device
# This is the "Actor" sitting in your level.
# Think of it like a Button Device, but smarter.
ChaosButtonDevice = device:
    # 2. Variables (The Loot Pool)
    # These are the items that can spawn.
    # We define them as a list (array) of weapon IDs.
    WeaponPool := ["ItemID_CombatAssaultRifle", "ItemID_CombatShotgun", "ItemID_CombatSMG"]
    
    # 3. The Widget Reference
    # We need a place to store the widget so we can interact with it later.
    # In Verse, we often use a "Handle" to keep track of spawned objects.
    ChaosMenuHandle: handle<widget> = uninitialized
    
    # 4. The Main Logic Function
    # This runs when the device is initialized (spawns into the world)
    OnBegin<override>()<suspends>: void =
        # --- PHASE 1: SPAWN THE UI ---
        
        # First, we need to actually create the widget.
        # We assume you have a widget blueprint named "ChaosMenu" in your Content Browser.
        # If you haven't made one, create a Widget Blueprint -> Modal Dialogue Variant.
        MenuWidget := CreateWidget<ChaosMenu>()
        
        # --- PHASE 2: MAKE IT INTERACTIVE ---

Sign in free to read the full source 🌴

This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.

Sign in with Discord

Comments

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