# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-volume-devices-in-fortnite-creative
# Local doc: epic-docs/documentation/en-us/fortnite-creative/using-volume-devices-in-fortnite-creative.md
# Section: Using Volume Devices In Verse
using { /Fortnite.com/Devices }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Verse.org/Simulation }
# A Verse-authored creative device that can be placed in a level
volume_device_verse_example := class(creative_device):
# Reference to the Volume device in the level.
# In the Details panel for this Verse device,
# set this property to your Volume device.
@editable
MyVolumeDevice:volume_device = volume_device{}
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
# Example for subscribing to an event on the Creative device.
# Signaled when an agent enters the Volume.
MyVolumeDevice.AgentEntersEvent.Subscribe(OnAgentEntered)
# Example for subscribing to an event on the Creative device.
# Signaled when an agent exits the Volume.
MyVolumeDevice.AgentExitsEvent.Subscribe(OnAgentExited)
# This function runs when an agent enters the Volume because it's an event handler for AgentEntersEvent.
OnAgentEntered(Agent:agent):void=
Print("Agent entered the volume.")
# This function runs when an agent exites the Volume because it's an event handler for AgentExitsEvent.
OnAgentExited(Agent:agent):void=
Print("Agent exited the volume.")
Verse Library
verse
01 Using Volume Devices In Verse
Demonstrates subscribing to enter and exit events on a volume device to react to player movement.
extracted-snippets/documentation/en-us/fortnite-creative/using-volume-devices-in-fortnite-creative/01-using-volume-devices-in-verse.verse