ULimenListenForKeyInput
Overview
ULimenListenForKeyInput is an asynchronous action class designed to listen for a specified key press by a player controller. It provides callbacks for when the correct key is pressed, when any other key is pressed, and when the timeout expires. This class extends UBlueprintAsyncActionBase, making it suitable for use in Blueprints.
Properties
Type | Name | Access | Description |
|---|---|---|---|
TWeakObjectPtr | PlayerController | Private | The player controller to listen for key input. |
FKey | Key | Private | The key to listen for. |
FDelegateHandle | WorldTickHandle | Private | Delegate handle for the world tick event. |
float | Timeout | Private | The timeout duration in seconds. |
bool | bUseTimeout | Private | Flag indicating whether a timeout is enabled. |
FListenForKeyInputDelegate | OnKeyPressed | Private | Delegate called when the correct key is pressed. |
FListenForKeyInputDelegate | OnWrongKeyPressed | Private | Delegate called when any other key is pressed. |
FListenForKeyInputDelegate | OnTimeout | Private | Delegate called when the timeout expires. |
Functions
Return Type | Signature | Description |
|---|---|---|
ULimenListenForKeyInput* | ListenForKeyInput(UObject* WorldContext, APlayerController* InPlayerController, const FKey& InKey, float InTimeout, FListenForKeyInputDelegate OnKeyPressed, FListenForKeyInputDelegate OnWrongKeyPressed, FListenForKeyInputDelegate OnTimeout) | Static function to create and activate a new instance of |
void | Activate() | Activates the async action. Sets up the key listening logic and timeout handling. |
void | WorldTick(UWorld* World, ELevelTick LevelTick, float DeltaTime) | Handles the world tick event to check for key presses and timeouts. |
Usage & Implementation Notes
Threading Constraints: This class operates on the game thread.
Replication Requirements: None.
Memory Lifetime Management: The instance is managed by Unreal Engine's garbage collection system.
Initialization Dependencies: Requires a valid
APlayerControllerand a key to listen for.