# This script changes the color of a cube when a button is pressed.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /Verse.org/Native }
using { /UnrealEngine.com/Temporary/Diagnostics }
# We define a new script type.
# This is like a blueprint for our code.
color_changer_script := class(creative_device):
# These are our "dials" or connections.
# We connect them in the editor later.
@editable
MyButton : button_device = button_device{}
@editable
MyCube : prop_manipulator_device = prop_manipulator_device{}
# This is the function that runs when the game starts.
OnBegin<override>()<suspends> : void =
# We wait for the button to be pressed.
# This is called an "Event."
loop:
# Await fires every time someone presses the button.
MyButton.InteractedWithEvent.Await()
# Here is the magic line!
# We change the material parameter.
# "BaseColor" is the name we made in Step 1.
Verse Library
verse
01 Device
Wires a button press to activate a cube prop and manage creative device interaction events.
verse-library/material-instance-editor/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.