RealDocs

UAnimInstance::QueueMontageEndedEvent

function Engine Since 4.0
#include "Animation/AnimInstance.h"
Access: public Specifiers: ENGINE_API

Description

Enqueues a montage-ended event to be dispatched at the end of the current animation update. This defers delegate invocation to a safe point in the tick, preventing re-entrant montage manipulation during evaluation.

Caveats & Gotchas

  • The queued event is not dispatched immediately — it fires after the current animation evaluation completes. Code that depends on the delegate having already fired within the same frame should use a post-evaluation callback instead.
  • If the owning skeletal mesh component is destroyed or the anim instance is torn down before the queue is flushed, the event is silently discarded and the delegate is never called.

Signature

ENGINE_API void QueueMontageEndedEvent(const FQueuedMontageEndedEvent& MontageEndedEvent);

Parameters

Name Type Description Default
MontageEndedEvent const FQueuedMontageEndedEvent& The event payload containing the montage that ended, whether it was interrupted, and the delegate to invoke.

Return Type

void

Example

Queue an ended event from a custom montage handler C++
void UMyAnimInstance::HandleMontageFinished(UAnimMontage* Montage, bool bInterrupted)
{
	FQueuedMontageEndedEvent EndedEvent;
	EndedEvent.Montage = Montage;
	EndedEvent.bInterrupted = bInterrupted;
	EndedEvent.OnMontageEnded = OnMontageEndedDelegate;
	QueueMontageEndedEvent(EndedEvent);
}

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.