Verse Library verse

07 Use Var Fields To Collect Information From Respond

Sends a custom event down the scene graph and tracks how many responder components handle it.

extracted-snippets/documentation/en-us/fortnite/scene-events-in-unreal-editor-for-fortnite/07-use-var-fields-to-collect-information-from-respond.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite/scene-events-in-unreal-editor-for-fortnite
# Local doc:  epic-docs/documentation/en-us/fortnite/scene-events-in-unreal-editor-for-fortnite.md
# Section:    Use var Fields to Collect Information from Responders
my_event<public> := class(scene_event):
I<public>:int
var Activations:int = 0      # Responders can increment this
# In the responder:
OnReceive<override>(E:scene_event):logic =
if (CE := my_event[E]):
set CE.Activations += 1
(super:)OnReceive(E)
# After sending:
Event := my_event{I := 1}
MyEntity.SendDown(Event)
Print("Activations: {Event.Activations}")   # How many components responded

Comments

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