RealDocs

UAbilitySystemComponent::CallReplicatedTargetDataDelegatesIfSet

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

Description

Fires the TargetData Confirm and Cancel delegates if target data has already been replicated for the given ability and prediction key pair. Returns true if the delegates were called.

Caveats & Gotchas

  • Only fires if target data was already received — if the server calls this before the client sends data, the delegates will not fire and you must bind to them manually via AbilityTargetDataSetDelegate.
  • Unlike CallAllReplicatedDelegatesIfSet, this only fires TargetData callbacks, not Generic Replicated Events — be careful not to mix the two patterns in the same ability.

Signature

UE_API bool CallReplicatedTargetDataDelegatesIfSet(FGameplayAbilitySpecHandle AbilityHandle, FPredictionKey AbilityOriginalPredictionKey)

Parameters

Name Type Description Default
AbilityHandle FGameplayAbilitySpecHandle Handle identifying the ability whose target data delegates should be invoked.
AbilityOriginalPredictionKey FPredictionKey The prediction key that was active when the ability was originally activated.

Return Type

bool

Example

Wait for or immediately fire target data delegates C++
// In a server-side ability task:
if (!ASC->CallReplicatedTargetDataDelegatesIfSet(AbilityHandle, OriginalPredKey))
{
    // Data not yet received — bind and wait
    ASC->AbilityTargetDataSetDelegate(AbilityHandle, OriginalPredKey)
        .AddUObject(this, &UMyTargetDataTask::OnTargetDataReceived);
}

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.