RealDocs

UAnimInstance::GetInstanceStateWeight

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

Description

Returns the current blend weight of a specific state within a state machine, ranging from 0.0 (not active) to 1.0 (fully active). Used by generated AnimBP code to drive state-aware blend logic and transition conditions.

Caveats & Gotchas

  • Both MachineIndex and StateIndex are compiler-assigned constants that change on blueprint recompile. Retrieve them via GetStateMachineIndex() and GetStateMachineInstanceDesc() rather than caching raw integers across editor sessions.
  • During a crossfade transition, multiple states may return non-zero weights simultaneously — the weights do not sum to 1.0 across all states until the transition completes.

Signature

UFUNCTION(BlueprintPure, Category="Animation", meta=(BlueprintInternalUseOnly = "true"))
float GetInstanceStateWeight(int32 MachineIndex, int32 StateIndex) const;

Parameters

Name Type Description Default
MachineIndex int32 Index of the state machine that contains the state.
StateIndex int32 Index of the state within the state machine.

Return Type

float

Example

Check if a specific state is fully active C++
int32 MachineIdx = GetStateMachineIndex(FName("LocomotionSM"));
int32 StateIdx   = GetStateMachineInstanceDesc(MachineIdx).GetStateIndex(FName("Run"));
if (GetInstanceStateWeight(MachineIdx, StateIdx) >= 1.0f)
{
	// Fully in Run state
}

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.