RealDocs

UAbilitySystemComponent::ServerSetReplicatedEventWithPayload

function GameplayAbilities Since 4.16
#include "AbilitySystemComponent.h"
Access: public Specifiers: UFUNCTIONServerreliableWithValidation

Description

Variant of ServerSetReplicatedEvent that carries a quantized vector payload, useful for passing aim direction or position data from the client to the server alongside the event.

Caveats & Gotchas

  • • The vector is quantized to 1/100 cm precision via FVector_NetQuantize100 — positions or directions requiring sub-centimetre accuracy will lose precision in transit.
  • • Like ServerSetReplicatedEvent, this is a reliable RPC; avoid calling it more than once per ability activation to prevent reliable buffer exhaustion.

Signature

void ServerSetReplicatedEventWithPayload(EAbilityGenericReplicatedEvent::Type EventType, FGameplayAbilitySpecHandle AbilityHandle, FPredictionKey AbilityOriginalPredictionKey, FPredictionKey CurrentPredictionKey, FVector_NetQuantize100 VectorPayload)

Parameters

Name Type Description Default
EventType EAbilityGenericReplicatedEvent::Type The type of generic replicated event. —
AbilityHandle FGameplayAbilitySpecHandle Handle to the ability spec this event belongs to. —
AbilityOriginalPredictionKey FPredictionKey The prediction key that was active when the ability was activated. —
CurrentPredictionKey FPredictionKey The prediction key active at the time this event is sent. —
VectorPayload FVector_NetQuantize100 An optional world-space vector sent alongside the event (e.g. aim direction or hit location). —

Return Type

void

Example

Sending aim direction with a confirm event C++
FVector AimDir = GetAimDirection();
ASC->ServerSetReplicatedEventWithPayload(
    EAbilityGenericReplicatedEvent::InputConfirm,
    AbilityHandle,
    OriginalPredictionKey,
    CurrentPredictionKey,
    AimDir);

Version History

Introduced in: 4.16

Version Status Notes
5.6 stable —

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.