#
API Reference
AfterPrime Systems | AP Event Bus | Version 1.0.0
Module: APEventBusRuntime
#
Contents
#
EAP_EventScope
Controls how an event is delivered across the network.
#
FAP_EventPayload
Self-contained event data. All fields are optional except EventTag. Passed by value through all publish and RPC paths.
Multiplayer Actor References
Instigator and Target serialize correctly across RPCs for replicated actors. If the referenced actor is not replicated, the pointer arrives as null on the remote end — this is expected UE5 behavior.
#
UAP_EventBusComponent
Type: UActorComponent
Display Name: AP_EventBus
Category: AP|EventBus
Core pub/sub component. Place on your GameState for a project-wide global bus, or on any individual Actor for a scoped per-actor bus. Each component instance is an independent bus.
Replication Model
All replication is RPC-based — there are no replicated UPROPERTYs on this component. Events are delivered via ServerPublishEvent, MulticastPublishEvent, ClientDeliverEvent, ServerRequestCachedEvents, and ClientReceiveCachedEvent RPCs internally. Do not call these RPCs directly.
#
Delegates
#
OnEventReceived
Fires for every event dispatched on this bus, regardless of tag. Use for catch-all listening.
Signature: (FGameplayTag EventTag, FAP_EventPayload Payload)
Fires on:
- Server — via direct dispatch (ServerOnly, OwnerOnly) or NetMulticast (All)
- Client — via NetMulticast (All), Client RPC (OwnerOnly), or late-join cache delivery
#
OnListenedEventReceived
Fires only for events whose EventTag matches a tag registered via ListenForEvent.
Signature: (FGameplayTag EventTag, FAP_EventPayload Payload)
Fires on the same paths as OnEventReceived, gated by the local tag filter set. Use alongside OnEventReceived when an actor only cares about a specific subset of bus traffic.
#
Publishing
#
PublishEvent
Any Machine
The only publish function you should call. Handles all routing automatically.
void PublishEvent(FAP_EventPayload Payload, EAP_EventScope Scope = EAP_EventScope::All)
Validation
If Payload.EventTag is not a valid registered Gameplay Tag, PublishEvent logs a warning and returns without firing.
#
Listeners
#
ListenForEvent
Any Machine
void ListenForEvent(FGameplayTag Tag)
Register a tag filter so OnListenedEventReceived fires when events with this tag are dispatched. Idempotent — calling twice with the same tag is safe. Has no effect on OnEventReceived.
#
StopListeningForEvent
Any Machine
void StopListeningForEvent(FGameplayTag Tag)
Remove a single tag from the filter set. No-op if the tag was not registered.
#
StopAllListening
Any Machine
void StopAllListening()
Clear all tag filters. Called automatically in EndPlay — you do not need to call this manually on actor destruction.
#
IsListeningForEvent
Any Machine BlueprintPure
bool IsListeningForEvent(FGameplayTag Tag) const
Returns true if the specified tag is currently in the filter set.
#
Cache
#
RegisterPersistentEvent
Server Only
void RegisterPersistentEvent(FGameplayTag Tag)
Mark a tag as persistent. After registration, every PublishEvent for this tag stores the payload in the server-side cache. Late-joining clients automatically receive the last cached payload for all persistent tags when their component's BeginPlay fires.
Call in GameState BeginPlay before any events fire.
#
UnregisterPersistentEvent
Server Only
void UnregisterPersistentEvent(FGameplayTag Tag)
Remove a tag from the persistent set and clear its cached payload. Future publishes for this tag will no longer be cached. Late joiners will not receive this event.
#
Query
Server + Client BlueprintPure
Client Cache
Query functions are meaningful on the server. On clients the cache is empty — use OnEventReceived to react to events on clients.
#
WasEventFired
bool WasEventFired(FGameplayTag Tag) const
Returns true if the tag is in the persistent cache and at least one PublishEvent has fired for it since registration.
#
GetLastPayload
bool GetLastPayload(FGameplayTag Tag, FAP_EventPayload& OutPayload) const
Retrieve the last cached payload for a persistent event tag.
Returns: true if found and OutPayload is populated. false if the tag is not in the cache.
#
GetAllCachedEventTags
Returns all tags currently in the persistent cache. Returns an empty container if no persistent events have been fired.
#
Lifecycle
Standard UActorComponent overrides — you do not call these directly.
#
Internal RPCs
Called internally by PublishEvent. Do not call these directly.
#
UAP_EventBusBlueprintLibrary
Static convenience functions. Available in Blueprint under AP|EventBus|Utilities.
#
GetEventBusComponent
static UAP_EventBusComponent* GetEventBusComponent(AActor* Actor)
Find the UAP_EventBusComponent on any Actor. Returns null if the actor is invalid or has no bus component.
#
GetEventBusFromGameState
static UAP_EventBusComponent* GetEventBusFromGameState(const UObject* WorldContextObject)
Get the UAP_EventBusComponent from the current world's GameState. The most common accessor when using the recommended global bus pattern.
Returns null if the world, GameState, or component is not found.
Timing
In multiplayer, call this after a short Delay (0.1s) in BeginPlay to ensure the GameState has replicated before access.
#
PublishEventOnBus
static void PublishEventOnBus(
AActor* BusOwner,
FAP_EventPayload Payload,
EAP_EventScope Scope = EAP_EventScope::All)
Convenience wrapper — finds the bus on BusOwner and calls PublishEvent. No-op if no bus component is found on the actor.
#
MakeEventPayload
static FAP_EventPayload MakeEventPayload(
FGameplayTag EventTag,
AActor* Instigator = nullptr,
AActor* Target = nullptr,
float Magnitude = 0.0f,
FGameplayTagContainer ContextTags = FGameplayTagContainer())
Construct and return a FAP_EventPayload. Appears as a pure node in Blueprint — use this instead of splitting struct pins manually.
#
AAP_EventBusDemoCharacter
C++ reference implementation demonstrating AP Event Bus usage. Ships as demo content — not required for plugin usage.
On BeginPlay, caches the GameState bus, binds both delegates, and registers three demo tag filters. On SetupPlayerInputComponent, binds four input actions (locally controlled only).
Demo Tags
Demo tags are not shipped in a plugin .ini file. Register them in your project's Gameplay Tags config before use.
#
Log Category
All plugin log output uses the LogEventBus category. Filter in the Output Log by typing LogEventBus.
AfterPrime Systems — Building the Gameplay Foundation