RealDocs

UAbilitySystemComponent::InvokeReplicatedEvent

function GameplayAbilities Since 4.15
#include "AbilitySystemComponent.h"
Access: public

Description

Fires all delegates registered for the given generic replicated event on this machine, if any. Returns true if delegates were found and invoked.

Caveats & Gotchas

  • Returns false if no delegates are registered for the event yet — this is expected during ability activation when the client sends the event before the server ability task has registered its delegate; the stored event will be consumed when the delegate registers later.
  • This does not send any RPCs — it only fires local delegates. Cross-machine replication is handled separately by ServerSetReplicatedEvent and ClientSetReplicatedEvent.

Signature

bool InvokeReplicatedEvent(EAbilityGenericReplicatedEvent::Type EventType, FGameplayAbilitySpecHandle AbilityHandle, FPredictionKey AbilityOriginalPredictionKey, FPredictionKey CurrentPredictionKey = FPredictionKey())

Parameters

Name Type Description Default
EventType EAbilityGenericReplicatedEvent::Type The type of event to invoke.
AbilityHandle FGameplayAbilitySpecHandle Handle to the ability spec.
AbilityOriginalPredictionKey FPredictionKey The prediction key active when the ability was activated.
CurrentPredictionKey FPredictionKey The current prediction key. Defaults to an empty key. FPredictionKey()

Return Type

bool

Example

Checking whether the event fired a waiting delegate C++
bool bFired = ASC->InvokeReplicatedEvent(
    EAbilityGenericReplicatedEvent::InputConfirm,
    AbilityHandle,
    OriginalPredictionKey,
    CurrentPredictionKey);
if (!bFired)
{
    // Delegate not yet registered; event is cached and will fire when it registers.
}

Version History

Introduced in: 4.15

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.