UAbilitySystemComponent::ConsumeAllReplicatedData
#include "AbilitySystemComponent.h"
Access: public
Description
Deletes all cached replicated data (target data and generic events) for the given ability handle and prediction key. Called after the server has processed the data and no longer needs it.
Caveats & Gotchas
- • Once consumed, all target data and event data are gone — do not call this before you have finished processing everything needed from this ability activation.
- • Failing to consume replicated data after an ability ends can leave stale data that affects the next activation of the same ability if prediction keys are reused.
Signature
void ConsumeAllReplicatedData(FGameplayAbilitySpecHandle AbilityHandle, FPredictionKey AbilityOriginalPredictionKey) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| AbilityHandle | FGameplayAbilitySpecHandle | Handle to the ability spec whose cached data should be cleared. | — |
| AbilityOriginalPredictionKey | FPredictionKey | The prediction key identifying which activation's data to clear. | — |
Return Type
void Example
Cleanup at the end of an ability on the server C++
void UMyGameplayAbility::EndAbility(
const FGameplayAbilitySpecHandle Handle,
const FGameplayAbilityActorInfo* ActorInfo,
const FGameplayAbilityActivationInfo ActivationInfo,
bool bReplicateEndAbility, bool bWasCancelled)
{
Super::EndAbility(Handle, ActorInfo, ActivationInfo, bReplicateEndAbility, bWasCancelled);
ActorInfo->AbilitySystemComponent->ConsumeAllReplicatedData(
Handle, ActivationInfo.GetActivationPredictionKey());
} See Also
Tags
Version History
Introduced in: 4.15
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?