RealDocs

UAbilitySystemComponent::ServerSetInputPressed

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

Description

Server RPC that directly replicates an input-pressed event for the given ability. Only use this when bReplicateInputDirectly is true on the ability; in most cases Generic Replicated Events are the preferred mechanism.

Caveats & Gotchas

  • This is a reliable Server RPC — using it for every frame of held input will flood the network; it is intended for discrete press events, not continuous hold state.
  • The header comment explicitly discourages this path: prefer Generic Replicated Events (ServerSetReplicatedEvent) over direct input replication for better latency tolerance.

Signature

UE_API void ServerSetInputPressed(FGameplayAbilitySpecHandle AbilityHandle)

Parameters

Name Type Description Default
AbilityHandle FGameplayAbilitySpecHandle Handle of the ability whose input-pressed state should be replicated to the server.

Return Type

void

Example

Direct input replication (uncommon pattern) C++
// Only needed when the ability has bReplicateInputDirectly = true:
void AMyCharacter::PressAbilityInput(FGameplayAbilitySpecHandle Handle)
{
    UAbilitySystemComponent* ASC = GetAbilitySystemComponent();
    if (ASC && ASC->GetOwnerRole() == ROLE_AutonomousProxy)
    {
        ASC->ServerSetInputPressed(Handle);
    }
}

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.