AActor::OnInputTouchBegin
#include "GameFramework/Actor.h"
Access: public
Specifiers: UPROPERTYBlueprintAssignable
Description
Delegate fired when a touch input begins over this actor while touch events are enabled in the player controller. Broadcasts the finger index and the touched actor.
Caveats & Gotchas
- • This delegate only fires when bEnableTouchEvents is true on the player controller and the actor's collision response allows touch traces. It will not fire for controllers that have not called EnableInput().
- • On mobile, multiple fingers can be active simultaneously; the ETouchIndex::Type parameter distinguishes them. Desktop mouse clicks map to ETouchIndex::Touch1 if touch simulation is enabled.
Signature
FActorOnInputTouchBeginSignature OnInputTouchBegin Example
Bind to touch begin in BeginPlay C++
void AMyActor::BeginPlay()
{
Super::BeginPlay();
OnInputTouchBegin.AddDynamic(this, &AMyActor::HandleTouchBegin);
}
void AMyActor::HandleTouchBegin(ETouchIndex::Type FingerIndex, AActor* TouchedActor)
{
UE_LOG(LogTemp, Log, TEXT("Finger %d touched %s"), (int32)FingerIndex, *GetNameSafe(TouchedActor));
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?