RealDocs

AActor::NotifyActorOnReleased

function Engine Since 4.0
#include "GameFramework/Actor.h"
Access: public Specifiers: virtual

Description

Called when the mouse button is released over this actor after a click, while click-events are enabled. Complements NotifyActorOnClicked for implementing press-and-release interaction patterns.

Caveats & Gotchas

  • The release event fires based on where the cursor is at release time, not where the button was pressed. If the player drags off the actor before releasing, this will not fire on the actor.
  • Like NotifyActorOnClicked, requires bEnableClickEvents on the PlayerController — both must be enabled for the full click/release cycle to work.

Signature

ENGINE_API virtual void NotifyActorOnReleased(FKey ButtonReleased = EKeys::LeftMouseButton);

Parameters

Name Type Description Default
ButtonReleased FKey The mouse button that was released. EKeys::LeftMouseButton

Return Type

void

Example

Implement drag-end logic on release C++
void AMyActor::NotifyActorOnReleased(FKey ButtonReleased)
{
    Super::NotifyActorOnReleased(ButtonReleased);
    if (ButtonReleased == EKeys::LeftMouseButton && bIsDragging)
    {
        bIsDragging = false;
        FinalizePosition();
    }
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.