UAnimInstance::WasAnimNotifyTriggeredInSourceState
#include "Animation/AnimInstance.h"
Access: public
Specifiers: UFUNCTIONBlueprintPure
Description
Returns true if a notify of the given class was triggered during the last frame while the specified state was the source state of a transition. Use this inside transition rules to condition transitions on notify events fired in the state being exited.
Caveats & Gotchas
- • MachineIndex and StateIndex are internal indices, not human-readable names. Use the BlueprintInternalUseOnly getter functions (GetCurrentStateName etc.) or hard-coded indices from the Anim BP compiler to obtain them reliably.
- • Only returns true for the single frame in which the notify was triggered; if your transition rule logic runs after that frame, the value will be false even though the notify did fire.
Signature
UFUNCTION(BlueprintPure, Category="Animation")
bool WasAnimNotifyTriggeredInSourceState(int32 MachineIndex, int32 StateIndex, TSubclassOf<UAnimNotify> AnimNotifyType) const; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| MachineIndex | int32 | Index of the state machine to query. | — |
| StateIndex | int32 | Index of the source state within the machine. | — |
| AnimNotifyType | TSubclassOf<UAnimNotify> | Class of the notify to check for. | — |
Return Type
bool Example
Check notify in transition rule (C++) C++
// Inside a custom UAnimInstance subclass, from a CanEnterTransition override:
bool UMyAnimInstance::CanEnterTransitionFromAttack(int32 MachineIndex, int32 StateIndex)
{
return WasAnimNotifyTriggeredInSourceState(MachineIndex, StateIndex, UAnimNotify_AttackEnd::StaticClass());
} See Also
Tags
Version History
Introduced in: 4.11
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?