AActor::EnableInput
#include "GameFramework/Actor.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallablevirtual
Description
Pushes this actor onto the input stack of the given PlayerController so it can receive and respond to input events. Creates the InputComponent if it does not already exist.
Caveats & Gotchas
- • This does not automatically bind any actions — after calling EnableInput you still need to set up bindings on InputComponent. The function only makes the actor eligible to receive input.
- • Input priority on the stack matters: actors pushed later receive input first. If you have multiple actors receiving input, be aware that one consuming an event will block actors lower in the stack.
Signature
ENGINE_API virtual void EnableInput(class APlayerController* PlayerController) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| PlayerController | APlayerController* | The PlayerController whose input stack this actor should be pushed onto. | — |
Return Type
void Examples
Enable player input when the player enters interaction range
Blueprint
Enable input on an interactable actor C++
void AMyInteractable::OnPlayerEnterRange(APlayerController* PC)
{
EnableInput(PC);
InputComponent->BindAction("Interact", IE_Pressed, this, &AMyInteractable::Interact);
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?