RealDocs

UEnhancedInputComponent::BindAction

function EnhancedInput Since 5.0
#include "EnhancedInputComponent.h"
Access: public

Description

Binds a callback to a UInputAction for a specific trigger event. The callback can accept no parameters, an FInputActionValue, or an FInputActionInstance.

Signature

FEnhancedInputActionEventBinding& BindAction(const UInputAction* Action, ETriggerEvent TriggerEvent, UserClass* Object, FunctionPtr Func, ...)

Parameters

Name Type Description Default
Action const UInputAction* The input action asset to bind.
TriggerEvent ETriggerEvent When to fire: Started, Triggered, Completed, Canceled, Ongoing.
Object UserClass* The object that owns the callback function.
Func FunctionPtr Member function pointer or lambda to call.

Return Type

FEnhancedInputActionEventBinding&

Caveats & Gotchas

  • ETriggerEvent::Triggered fires every frame the action is active (held). ETriggerEvent::Started fires once on the first frame. Use the right event for the right behaviour.
  • The callback signature must match one of three accepted forms: void(), void(const FInputActionValue&), or void(const FInputActionInstance&). Mismatched signatures cause a compile error.
  • If the UInputAction asset is null, the binding is silently ignored — no error. Always ensure action assets are assigned in your character's UPROPERTY.

Example

Binding jump, move, and look C++
// No param — just trigger the event
EIC->BindAction(JumpAction, ETriggerEvent::Started, this, &AMyCharacter::Jump);

// FInputActionValue param — read axis value
void AMyCharacter::Move(const FInputActionValue& Value)
{
	FVector2D Input = Value.Get<FVector2D>();
	AddMovementInput(GetActorForwardVector(), Input.Y);
	AddMovementInput(GetActorRightVector(), Input.X);
}

Version History

Introduced in: 5.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.