RealDocs

UAnimInstance::WasAnimNotifyStateActiveInStateMachine

function Engine Blueprint Since 4.8
#include "Animation/AnimInstance.h"
Access: public Specifiers: UFUNCTION

Description

Returns true if the specified AnimNotifyState type was active in any state of a particular state machine during the last animation evaluation. Narrows the query of WasAnimNotifyStateActiveInAnyState to a single machine, preventing false positives from notify states in unrelated machines.

Caveats & Gotchas

  • Like the other WasAnimNotifyState* functions, this reflects the previous frame's evaluation result. Use it in NativeUpdateAnimation for reliable per-frame queries rather than in event callbacks where ordering relative to the evaluation update matters.
  • If the same AnimInstance has multiple state machines that could legitimately host the same notify state, use WasAnimNotifyStateActiveInSourceState to pinpoint the exact machine-and-state combination.

Signature

UFUNCTION(BlueprintPure, Category="Animation")
bool WasAnimNotifyStateActiveInStateMachine(int32 MachineIndex, TSubclassOf<UAnimNotifyState> AnimNotifyStateType) const;

Parameters

Name Type Description Default
MachineIndex int32 Index of the state machine to restrict the search to.
AnimNotifyStateType TSubclassOf<UAnimNotifyState> The class of anim notify state to check for.

Return Type

bool

Example

Enable IK only when a specific state machine hosts the IK notify C++
int32 UpperBodyMachineIdx = GetStateMachineIndex(FName("UpperBodySM"));
bIKEnabled = WasAnimNotifyStateActiveInStateMachine(
	UpperBodyMachineIdx,
	UNS_EnableHandIK::StaticClass()
);

Version History

Introduced in: 4.8

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.