Verse Library verse

01 Using Analytics In Verse

Subscribes to damage volume events and submits player analytics data when agents enter.

extracted-snippets/documentation/en-us/fortnite/using-analytics-devices-in-fortnite-creative/01-using-analytics-in-verse.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite/using-analytics-devices-in-fortnite-creative
# Local doc:  epic-docs/documentation/en-us/fortnite/using-analytics-devices-in-fortnite-creative.md
# Section:    Using Analytics in Verse
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# A Verse-authored creative device that can be placed in a level
analytics_device_verse_example := class(creative_device):
# Reference to the Analytics device in the level.
# In the Details panel for this Verse device,
# set this property to your Analytics device.
@editable
MyAnalyticsDevice:analytics_device = analytics_device{}
# Reference to the Damage Volume device in the level.
# In the Details panel for this Verse device,
# set this property to your Damage Volume device.
@editable
DamageVolume:damage_volume_device = damage_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 damage volume.
DamageVolume.AgentEntersEvent.Subscribe(OnAgentEntered)
# This function runs when an agent enters the damage volume because it's an event handler for the Damage Volume device's AgentEntersEvent.
OnAgentEntered(Agent:agent):void=
# Submits an event for `Agent` to generate analytics.
MyAnalyticsDevice.Submit(Agent)

Comments

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