UInputComponent

Implement an Actor component for input bindings.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/Components/InputComponent.h

Include

#include "Components/InputComponent.h"

Syntax

class UInputComponent : public UActorComponent

Remarks

Implement an Actor component for input bindings.

An Input Component is a transient component that enables an Actor to bind various forms of input events to delegate functions. Input components are processed from a stack managed by the PlayerController and processed by the PlayerInput. Each binding can consume the input event preventing other components on the input stack from processing the input.

Variables

Name Description

Public variable

TArray< FInputA...

 

AxisBindings

The collection of axis bindings.

Public variable

TArray< FInputA...

 

AxisKeyBindings

The collection of axis key bindings.

Public variable

uint8: 1

 

bBlockInput

Whether any components lower on the input stack should be allowed to receive input.

Public variable

TArray< FInputG...

 

GestureBindings

The collection of gesture bindings.

Public variable

TArray< FInputK...

 

KeyBindings

The collection of key bindings.

Public variable

int32

 

Priority

The priority of this input component when pushed in to the stack.

Public variable

TArray< FInputT...

 

TouchBindings

The collection of touch bindings.

Public variable

TArray< FInputV...

 

VectorAxisBindings

The collection of vector axis bindings.

Constructors

Name Description

Public function

UInputComponent

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function

FInputAction...

 

AddActionBinding

(
    FInputActionBinding Binding
)

Adds the specified action binding.

Public function

FInputAction...

 

BindAction

(
    const FName ActionName,
    const EInputEvent KeyEvent,
    UserClass* Object,
    typename DelegateType::template TUO...,
    VarTypes... Vars
)

Binds a delegate function to an Action defined in the project settings.

Public function

FInputAction...

 

BindAction

(
    const FName ActionName,
    const EInputEvent KeyEvent,
    UserClass* Object,
    typename FInputActionHandlerWithKey...
)

Binds a delegate function to an Action defined in the project settings.

Public function

FInputAction...

 

BindAction

(
    const FName ActionName,
    const EInputEvent KeyEvent,
    UserClass* Object,
    typename FInputActionHandlerSignatu...
)

Binds a delegate function to an Action defined in the project settings.

Public function

FInputAxisBi...

 

BindAxis

(
    const FName AxisName,
    UserClass* Object,
    typename FInputAxisHandlerSignature...
)

Binds a delegate function an Axis defined in the project settings.

Public function

FInputAxisBi...

 

BindAxis

(
    const FName AxisName
)

Indicates that the InputComponent is interested in knowing the Axis value (via GetAxisValue) but does not want a delegate function called each frame.

Public function

FInputAxisKe...

 

BindAxisKey

(
    const FKey AxisKey,
    UserClass* Object,
    typename FInputAxisHandlerSignature...
)

Binds a delegate function for an axis key (e.g. Mouse X).

Public function

FInputAxisKe...

 

BindAxisKey

(
    const FKey AxisKey
)

Indicates that the InputComponent is interested in knowing/consuming an axis key's value (via GetAxisKeyValue) but does not want a delegate function called each frame.

Public function

FInputGestur...

 

BindGesture

(
    const FKey GestureKey,
    UserClass* Object,
    typename FInputGestureHandlerSignat...
)

Binds a gesture event to a delegate function.

Public function

FInputKeyBin...

 

BindKey

(
    const FInputChord Chord,
    const EInputEvent KeyEvent,
    UserClass* Object,
    typename FInputActionHandlerSignatu...
)

Binds a chord event to a delegate function.

Public function

FInputKeyBin...

 

BindKey

(
    const FKey Key,
    const EInputEvent KeyEvent,
    UserClass* Object,
    typename FInputActionHandlerSignatu...
)

Binds a key event to a delegate function.

Public function

FInputTouchB...

 

BindTouch

(
    const EInputEvent KeyEvent,
    UserClass* Object,
    typename FInputTouchHandlerSignatur...
)

Binds this input component to touch events.

Public function

FInputVector...

 

BindVectorAxis

(
    const FKey AxisKey,
    UserClass* Object,
    typename FInputVectorAxisHandlerSig...
)

Binds a delegate function to a vector axis key (e.g. Tilt) Returned reference is only guaranteed to be valid until another vector axis key is bound.

Public function

FInputVector...

 

BindVectorAxis

(
    const FKey AxisKey
)

Indicates that the InputComponent is interested in knowing/consuming a vector axis key's value (via GetVectorAxisKeyValue) but does not want a delegate function called each frame.

Public function

void

 

ClearActionBindings()

Removes all action bindings.

Public function

void

 

ClearBindingValues()

Clears all cached binding values.

Public function

void

 

ConditionalBuildKeyMap

(
    UPlayerInput* PlayerInput
)

Public function Const

FInputAction...

 

GetActionBinding

(
    const int32 BindingIndex
)

Gets the action binding with the specified index.

Public function Const

float

 

GetAxisKeyValue

(
    const FKey AxisKey
)

Gets the current value of the axis with the specified key.

Public function Const

float

 

GetAxisValue

(
    const FName AxisName
)

Gets the current value of the axis with the specified name.

Public function Const

int32

 

GetNumActionBindings()

Gets the number of action bindings.

Public function Const

FVector

 

GetVectorAxisValue

(
    const FKey AxisKey
)

Gets the current vector value of the axis with the specified key.

Public function Const

bool

 

HasBindings()

Checks whether this component has any input bindings.

Public function

void

 

RemoveActionBinding

(
    const int32 BindingIndex
)

Removes the action binding at the specified index.

Public function

void

 

RemoveActionBinding

(
    const FInputActionBinding& Binding...,
    const int32 BindingIndex
)

Removes the action binding (index need for multi-name fixups).

Public function

void

 

RemoveActionBinding

(
    FName ActionName,
    EInputEvent KeyEvent
)

Removes the action binding at the specified index.

Public function

void

 

RemoveActionBindingForHandle

(
    const int32 Handle
)

Removes the action binding at the specified handle.

See Also

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss