AActor::ReceiveActorOnClicked
#include "GameFramework/Actor.h"
Access: public
Specifiers: UFUNCTIONBlueprintImplementableEvent
Description
Blueprint implementable event called when the mouse clicks this actor while click events are enabled on the player controller.
Caveats & Gotchas
- • The C++ override point is `NotifyActorOnClicked()`, which calls this Blueprint event. Override the virtual `NotifyActorOnClicked` in C++ subclasses rather than the generated thunk.
- • Both `bEnableClickEvents` on the PlayerController and collision on the actor must be set up correctly for this event to fire.
- • The `ButtonPressed` parameter identifies which mouse button was used — useful for distinguishing left from right clicks in a single handler.
Signature
UFUNCTION(BlueprintImplementableEvent, meta=(DisplayName = "ActorOnClicked"), Category="Mouse Input")
ENGINE_API void ReceiveActorOnClicked(FKey ButtonPressed = EKeys::LeftMouseButton); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| ButtonPressed | FKey | The mouse button that was pressed. | EKeys::LeftMouseButton |
Return Type
void Example
Log which button was pressed in C++ C++
void AMyActor::NotifyActorOnClicked(FKey ButtonPressed)
{
Super::NotifyActorOnClicked(ButtonPressed);
if (ButtonPressed == EKeys::RightMouseButton)
{
OpenContextMenu();
}
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?