RealDocs

UAnimInstance::GetInstanceAssetPlayerIndex

function Engine Since 4.11
#include "Animation/AnimInstance.h"
Access: public Specifiers: ENGINE_API

Description

Looks up the flat index of an asset player node given its state machine, state, and node name. Used internally by AnimGetters and AnimInstance proxy objects to map logical names to runtime indices.

Caveats & Gotchas

  • Returns INDEX_NONE (-1) if the named node cannot be found. Always validate the returned index before passing it to GetInstanceAssetPlayerTime or similar indexed accessors.
  • The indices are baked at compile time from the animation blueprint graph and are stable for a given blueprint compilation. Recompiling the blueprint can change indices, so never serialize or cache them across sessions.

Signature

ENGINE_API int32 GetInstanceAssetPlayerIndex(FName MachineName, FName StateName, FName AssetPlayerNodeName) const;

Parameters

Name Type Description Default
MachineName FName Name of the state machine containing the asset player.
StateName FName Name of the state within the state machine.
AssetPlayerNodeName FName Name of the specific asset player node.

Return Type

int32

Example

Look up asset player index by name C++
int32 Index = AnimInstance->GetInstanceAssetPlayerIndex(
    FName("Locomotion"),
    FName("Idle"),
    FName("IdleAnim")
);
if (Index != INDEX_NONE)
{
    float Time = AnimInstance->GetInstanceAssetPlayerTime(Index);
}

Version History

Introduced in: 4.11

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.