UAnimInstance::WasAnimNotifyStateActiveInSourceState
#include "Animation/AnimInstance.h"
Access: public
Specifiers: UFUNCTION
Description
Returns true if the specified AnimNotifyState type was active specifically within the given state machine state during the last animation evaluation. Provides the most precise notify state query, scoped to a single state in a single machine.
Caveats & Gotchas
- • Despite the name 'SourceState', this queries any named state — not exclusively transition source states. The naming reflects its origin in transition-rule contexts where the state being transitioned away from is the 'source'.
- • Both MachineIndex and StateIndex are compiler-assigned and change on blueprint recompile. Cache these indices carefully and treat them as invalidated whenever the Animation Blueprint is recompiled in the editor.
Signature
UFUNCTION(BlueprintPure, Category="Animation")
bool WasAnimNotifyStateActiveInSourceState(int32 MachineIndex, int32 StateIndex, TSubclassOf<UAnimNotifyState> AnimNotifyStateType) const; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| MachineIndex | int32 | Index of the state machine that owns the source state. | — |
| StateIndex | int32 | Index of the state within the state machine to check. | — |
| AnimNotifyStateType | TSubclassOf<UAnimNotifyState> | The class of anim notify state to check for. | — |
Return Type
bool Example
Apply a screen-shake only while in the attack state with the shockwave notify C++
int32 CombatMachineIdx = GetStateMachineIndex(FName("CombatSM"));
int32 AttackStateIdx = GetStateMachineInstanceDesc(CombatMachineIdx).GetStateIndex(FName("HeavyAttack"));
if (WasAnimNotifyStateActiveInSourceState(
CombatMachineIdx,
AttackStateIdx,
UNS_ShockwaveShake::StaticClass()))
{
GetWorld()->GetFirstPlayerController()->ClientStartCameraShake(ShakeClass);
} See Also
Tags
Version History
Introduced in: 4.8
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?