# This is our main script. It controls the game logic.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# This is our main class. It holds all our code.
my_button_script := class(creative_device):
# Here is the magic link!
# We create a variable named 'MyButton'.
# It expects a 'button_device'.
# In the editor, you will drag your actual button here.
@editable
MyButton: button_device = button_device{}
# We also need a link to a prop_manipulator_device.
# Drag your placed Prop Manipulator into this slot in the editor.
# note: prop_manipulator_device lets us change a prop's appearance at runtime.
@editable
MyPropManipulator: prop_manipulator_device = prop_manipulator_device{}
# This function runs when the game starts.
OnBegin<override>()<suspends>: void =
# We wait for the button to be pressed.
# 'InteractedWithEvent' fires each time a player clicks the button.
MyButton.InteractedWithEvent.Await()
# When the button is pressed, do this:
# Tell the prop manipulator to enable, which triggers
# whatever effect you configured on it in the editor.
Verse Library
verse
01 Device
Links a button press to a prop manipulator to trigger effects at runtime.
verse-library/set-this-property-to-your-button-device/01-device.verse
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.