UAnimInstance::GetInstanceMachineWeight
#include "Animation/AnimInstance.h"
Access: public
Specifiers: UFUNCTION
Description
Returns the current blend weight (0.0–1.0) of the state machine at the given index. Used internally by generated Animation Blueprint code to expose state machine weights to transition rules and blend logic.
Caveats & Gotchas
- • MachineIndex is assigned by the AnimBP compiler and can change whenever the animation blueprint is recompiled or the state machine graph is restructured. Never hard-code a machine index in C++ — retrieve it via GetStateMachineIndex() or use the generated blueprint functions.
- • This function is marked BlueprintInternalUseOnly; it is intended to be called from auto-generated AnimBP code, not from hand-authored Blueprint graphs. Calling it directly in C++ is valid but the index must be obtained from the compiled AnimBP's internal constants.
Signature
UFUNCTION(BlueprintPure, Category="Animation", meta=(BlueprintInternalUseOnly = "true"))
float GetInstanceMachineWeight(int32 MachineIndex) const; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| MachineIndex | int32 | Index of the state machine node within the compiled animation blueprint. | — |
Return Type
float Example
Read machine weight from a compiled AnimBP constant C++
// MachineIndex comes from the AnimBP compiler — access via GetStateMachineIndex
int32 MachineIdx = GetStateMachineIndex(FName("LocomotionSM"));
if (MachineIdx != INDEX_NONE)
{
float Weight = GetInstanceMachineWeight(MachineIdx);
UE_LOG(LogAnim, Log, TEXT("LocomotionSM weight: %f"), Weight);
} See Also
Tags
Version History
Introduced in: 4.8
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?