UAnimInstance::GetCurrentStateName
#include "Animation/AnimInstance.h"
Access: public
Specifiers: UFUNCTIONBlueprintPure
Description
Returns the name of the currently active state in the given state machine. Intended for use inside the AnimBP graph via the generated blueprint getter; C++ code typically works with state indices directly.
Caveats & Gotchas
- • Marked BlueprintInternalUseOnly — the AnimBP compiler generates a correctly typed wrapper for Blueprint use. Calling this from user Blueprint code directly is not intended and may produce unexpected results.
- • During a transition, this returns the destination state name, not the source state. If you need the source state name, query it before committing the transition or use the transition rule context.
Signature
UFUNCTION(BlueprintPure, Category="Animation", meta=(BlueprintInternalUseOnly = "true"))
FName GetCurrentStateName(int32 MachineIndex) const; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| MachineIndex | int32 | Index of the state machine to query. | — |
Return Type
FName Example
Read active state name in C++ debug code C++
FName ActiveState = GetCurrentStateName(0); // Machine 0
UE_LOG(LogTemp, Log, TEXT("Current locomotion state: %s"), *ActiveState.ToString()); See Also
Tags
Version History
Introduced in: 4.11
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?