RealDocs

UAbilitySystemComponent::CallReplicatedEventDelegateIfSet

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

Description

Fires the delegate for a specific Generic Replicated Event if that event has already been sent, returning true if it fired. Use this on the receiving end (typically the server) to handle events that may arrive before or after local setup.

Caveats & Gotchas

  • Returns false and does nothing if the event has not yet been received — you must manually register via CallOrAddReplicatedDelegate if you need guaranteed delivery.
  • Each Generic Replicated Event type occupies a separate slot per ability/prediction-key pair; calling this for the wrong EventType will silently return false.

Signature

UE_API bool CallReplicatedEventDelegateIfSet(EAbilityGenericReplicatedEvent::Type EventType, FGameplayAbilitySpecHandle AbilityHandle, FPredictionKey AbilityOriginalPredictionKey)

Parameters

Name Type Description Default
EventType EAbilityGenericReplicatedEvent::Type The generic replicated event type to check (e.g. InputPressed, TargetSetOrCancelled).
AbilityHandle FGameplayAbilitySpecHandle Handle identifying the ability.
AbilityOriginalPredictionKey FPredictionKey Prediction key from when the ability was activated.

Return Type

bool

Example

Check and fire a generic replicated event on the server C++
// Server-side ability task wanting InputConfirm notification:
if (!ASC->CallReplicatedEventDelegateIfSet(
        EAbilityGenericReplicatedEvent::InputConfirm,
        AbilityHandle, OriginalPredKey))
{
    // Not yet received — register so it fires when it arrives
    ASC->AbilityReplicatedEventDelegate(
            EAbilityGenericReplicatedEvent::InputConfirm,
            AbilityHandle, OriginalPredKey)
        .AddUObject(this, &UMyTask::OnConfirm);
}

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.