UAbilitySystemComponent::CallAllReplicatedDelegatesIfSet
#include "AbilitySystemComponent.h"
Access: public
Description
Fires all pending replicated delegates (target data and generic events) that have already been received but not yet invoked for the given ability activation.
Caveats & Gotchas
- • The header comment warns this can be dangerous when multiple places in an ability register events and then call this function — delegates registered by one code path may be fired unexpectedly by another path's call.
- • Prefer the targeted variants (CallReplicatedTargetDataDelegatesIfSet / CallReplicatedEventDelegateIfSet) when only a specific delegate type needs to be flushed, to avoid unintended cross-task interactions.
Signature
void CallAllReplicatedDelegatesIfSet(FGameplayAbilitySpecHandle AbilityHandle, FPredictionKey AbilityOriginalPredictionKey) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| AbilityHandle | FGameplayAbilitySpecHandle | Handle to the ability spec. | — |
| AbilityOriginalPredictionKey | FPredictionKey | The prediction key identifying the activation. | — |
Return Type
void Example
Flushing all pending data at ability activation C++
void UMyGameplayAbility::ActivateAbility(
const FGameplayAbilitySpecHandle Handle,
const FGameplayAbilityActorInfo* ActorInfo,
const FGameplayAbilityActivationInfo ActivationInfo,
const FGameplayEventData* TriggerEventData)
{
Super::ActivateAbility(Handle, ActorInfo, ActivationInfo, TriggerEventData);
// Flush any replication data already received before ability tasks register delegates
ActorInfo->AbilitySystemComponent->CallAllReplicatedDelegatesIfSet(
Handle, ActivationInfo.GetActivationPredictionKey());
} See Also
Tags
Version History
Introduced in: 4.15
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?