RealDocs

UAnimInstance::GetMachineDescription

function Engine Since 4.0
#include "Animation/AnimInstance.h"
Access: public Specifiers: const

Description

Retrieves the baked (compiled) state machine description for a given state machine instance. The baked description contains the static structure of the state machine including state names, transition rules, and graph topology as compiled from the Animation Blueprint.

Caveats & Gotchas

  • Returns nullptr if the machine instance does not belong to the provided anim class or if the baked data has not been generated. This typically means the Animation Blueprint needs to be recompiled.
  • The returned description is the compiled, read-only representation. It reflects the state machine structure at compile time, not runtime modifications. Any dynamic changes to transition rules are not reflected here.

Signature

const FBakedAnimationStateMachine* GetMachineDescription(IAnimClassInterface* AnimBlueprintClass, FAnimNode_StateMachine* MachineInstance)

Parameters

Name Type Description Default
AnimBlueprintClass IAnimClassInterface* The anim class interface to query for the state machine description.
MachineInstance FAnimNode_StateMachine* The state machine instance whose baked description to retrieve.

Return Type

const FBakedAnimationStateMachine*

Example

Get baked state machine description C++
void UMyAnimInstance::InspectStateMachine()
{
    int32 MachineIndex = GetStateMachineIndex(FName("Locomotion"));
    if (FAnimNode_StateMachine* SM = GetStateMachineInstance(MachineIndex))
    {
        IAnimClassInterface* AnimClass = IAnimClassInterface::GetFromClass(GetClass());
        if (const FBakedAnimationStateMachine* Desc = GetMachineDescription(AnimClass, SM))
        {
            UE_LOG(LogAnimation, Log, TEXT("State machine '%s' has %d states"),
                *Desc->MachineName.ToString(), Desc->States.Num());
        }
    }
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.