Skip to main content

Add Observer (Event)

UFUNCTION(
BlueprintCallable,
Meta = (DisplayName = "Add Observer (Event)", DefaultToSelf = "Observer", AutoCreateRefTerm = "EventClass"),
Category = "Event System")
FLES_ObserverHandle BP_AddObserver_Event(
UPARAM(Meta = (AllowAbstract = "false")) const TSubclassOf<ULES_Event>& EventClass, UObject* Observer,
FLES_EventHandler Callback, const FName Channel = NAME_None);
Parameters
EventClassThe static class of the events the Observer should listen for.
ObserverThe object that will be notified when events of EventClass type are sent on the Channel.
CallbackThe event handler that will be called when the event is received.
ChannelDetermines the channel the event will be sent on. Observers are notified only about the events sent on the channel they're listening on.
ReturnA handle to the newly created observer record in the Event System. You may use this handle later to remove this particular observer record from the Event System.

Adds the Observer to the Event System and marks it as listening for events of EventClass type, that are sent on the specified Channel. The Callback will not be called if an Event is sent and the Observer has already been garbage-collected.

Example usage: