RealDocs

UAbilitySystemComponent::AbilitySpecInputPressed

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

Description

Notifies the ASC that the input bound to a specific ability spec was pressed. Called on the local player always, and on the server only when bReplicateInputDirectly is set on the ability.

Caveats & Gotchas

  • If bReplicateInputDirectly is false (the default), this is only called locally — the server does not see the raw press event and instead relies on prediction keys or explicit RPCs to trigger abilities.
  • The spec's InputPressed flag is set to true inside this call. Active ability instances also receive their InputPressed() callback here. If the ability has multiple instances (instanced-per-execution), all of them get the callback.
  • Prefer ability activation through TryActivateAbility or input binding via the enhanced-input GAS integration rather than calling this directly, unless you are building a custom input pipeline.

Signature

UE_API virtual void AbilitySpecInputPressed(FGameplayAbilitySpec& Spec);

Parameters

Name Type Description Default
Spec FGameplayAbilitySpec& The ability spec whose input button was just pressed.

Return Type

void

Example

Custom input handler calling AbilitySpecInputPressed C++
void UMyAbilitySystemComponent::OnAbilityInputTagPressed(FGameplayTag InputTag)
{
    for (FGameplayAbilitySpec& Spec : GetActivatableAbilities())
    {
        if (Spec.GetDynamicSpecSourceTags().HasTagExact(InputTag))
        {
            AbilitySpecInputPressed(Spec);
        }
    }
}

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.