Skip to content

Get Anim Instance / Set Animation Mode / Set Anim Instance Class

At a glance

Target: one exact SkeletalMeshComponent · Component owns: its Animation Mode, Anim Class, and live transient Anim Instance · Get Anim Instance returns: AnimInstancemay be None; the real object can be your Animation Blueprint class or another Anim Instance subclass · Setters return: execution only — no success Boolean · Reinitialization: changing mode/class can replace the live instance and discard its runtime state · Hard boundary: Set Anim Instance Class fails with a warning while the current instance is evaluating · Official pages: Get Anim Instance, Set Animation Mode, and Set Anim Instance Class

The asset, class, and object are three different things. An Animation Blueprint asset generates a class; a Skeletal Mesh Component stores that class choice; at runtime the component creates a transient Anim Instance object from it.

The one-minute version

  • These nodes target a Skeletal Mesh Component, not the Character/Pawn as a whole. A Character can have body, first-person arms, face, weapon, and outfit mesh components, each with a different live Anim Instance.
  • Get Anim Instance returns the live object currently driving that one component, typed as the broad AnimInstance class. Cast it to the project's Animation Blueprint class only after checking for None.
  • The object is transient. Do not call/cache it in Construction Script. Obtain it after the component has initialized at runtime.
  • Set Animation Mode chooses between Use Animation Blueprint, Use Animation Asset (single node), and Custom Mode. Changing mode normally reinitializes the component's animation path.
  • Force Init Anim Script Instance can reinitialize Animation Blueprint mode even when that mode was already selected. That reset is real; it is not a harmless refresh.
  • Set Anim Instance Class assigns a new Anim Instance class, switches the component to Animation Blueprint mode, clears the old live instance, and initializes a new one.
  • Reinitialization does not migrate Animation Blueprint variables, state-machine time, active Montage playback, or cached references from the old object.
  • An Animation Blueprint class must target the Skeletal Mesh's Skeleton (or a compatible Skeleton). The class pin guarantees an Anim Instance subclass, not Skeleton compatibility.
  • Do not change Anim Instance class from an Anim Notify/current animation evaluation. Epic's UE 5.8 contract says that call fails with a warning. Defer the change to the owning Actor/game thread after evaluation.
  • Anim Instances are local transient presentation objects, not replicated gameplay state. A setter call on one machine does not switch every client's mesh automatically.

Who owns what?

flowchart LR
    Asset[Animation Blueprint asset] --> Generated[Generated Anim Instance class]
    Skeleton[Target Skeleton] --> Generated
    MeshAsset[Skeletal Mesh + Skeleton] --> Component[Skeletal Mesh Component]
    Mode[Animation Mode] --> Component
    Generated -->|Anim Class| Component
    Component -->|creates / owns| Live[Transient live Anim Instance]
    Live --> Pose[AnimGraph pose for this component]

The live instance belongs to the component. It does not belong globally to the Character class, and it is not the Animation Blueprint asset in the Content Browser.

Get Anim Instance

Get Anim Instance reads the component's current main AnimScriptInstance and returns it through an AnimInstance-typed object pin.

pseudocode — not engine source

SkeletalMeshComponent.GetAnimInstance():
    return this component's current live AnimScriptInstance
    // can be None

The declared pin type is broad. At runtime it may carry:

Component state Possible real object
Use Animation Blueprint with ABP_Hero initialized An instance of the class generated by ABP_Hero.
Use Animation Asset / single-node mode initialized A UAnimSingleNodeInstance, not ABP_Hero.
No valid class/initialization yet None.
Custom Mode Whatever custom/current Anim Instance that advanced setup leaves in place.

That is why this common graph needs both guards:

BodyMesh
-> Get Anim Instance
-> Is Valid
-> Cast To ABP_Hero
   Success: use ABP_Hero-specific functions/variables
   Failed: this mesh is driven by another Anim Instance type

Get Anim Instance is read-only. A None result from a valid component is silent: no exception, failure execution pin, automatic retry, or log is provided. Calling the node with a None component target is different — that is an invalid-reference Blueprint call.

“Valid” does not always mean “still driving the mesh”

If gameplay caches the old Anim Instance and the mesh later reinitializes, the cached UObject can remain non-None and even pass Is Valid while a Blueprint reference keeps it alive. It is still stale: the component now drives a new instance.

When mode/class/mesh can change, re-fetch after the change or handle the component's animation-initialized notification. For a defensive check:

CachedAnimInstance Is Valid
AND
BodyMesh.GetAnimInstance == CachedAnimInstance

Object validity answers “may I safely reference this UObject?” It does not answer “is this still the component's active animation program?”

Set Animation Mode

Animation Mode tells the Skeletal Mesh Component which broad animation path it should use:

Blueprint label Engine enum Meaning
Use Animation Blueprint AnimationBlueprint Create/run the component's assigned Anim Class and its AnimGraph.
Use Animation Asset AnimationSingleNode Drive one animation asset through a single-node Anim Instance; no normal project AnimBP state machine.
Custom Mode AnimationCustomMode Advanced ownership; the engine leaves the Anim Instance as-is instead of choosing the usual Blueprint/single-node path.

Changing from one normal mode to another initializes the new path. For example:

Use Animation Blueprint (ABP_Hero running)
-> Set Animation Mode(Use Animation Asset)
-> ABP_Hero no longer drives the component
-> single-node playback data owns the pose

Switching back to Animation Blueprint mode initializes the assigned Anim Class again. Treat that as a new live instance unless you have proved otherwise.

Force Init Anim Script Instance

When the requested mode is already Animation Blueprint:

  • false: do not request a reinitialization merely because the same mode was assigned again;
  • true: initialize/reinitialize the Anim Script Instance even though the mode did not change.

Epic exposes this partly so a Blueprint Construction Script can request AnimBP initialization in the same mode. That does not make a live instance durable in Construction Script. Construction can rerun in the editor, and runtime registration can initialize animation again. Configure defaults there; obtain runtime references later.

Set Anim Instance Class

Set Anim Instance Class takes a class, not an existing Anim Instance object:

pseudocode — not engine source

SkeletalMeshComponent.SetAnimInstanceClass(NewClass):
    if the current Anim Instance is evaluating:
        warn and fail
        return

    set Anim Class = NewClass
    set Animation Mode = Animation Blueprint
    clear/uninitialize the old live instance
    initialize a live instance from NewClass when valid/compatible

The official contract explicitly promises the mode switch and reinitialization. Do not treat this like changing a class label on the same UObject. The old and new instances have different identity and lifetime.

Reinitialization can reset or replace:

  • Event Blueprint Initialize Animation state;
  • Animation Blueprint variables at their defaults;
  • active state-machine state and elapsed times;
  • active Montage/single-node playback owned by the old instance;
  • linked/sub-instance runtime state associated with the old main instance;
  • external casts, delegate bindings, or cached references pointing at the old object; and
  • debug-object selection in the Animation Blueprint editor.

The new instance begins its own initialization lifecycle. If a gameplay mode needs state on both sides of the swap, keep that state on the Character, component, PlayerState, or another durable gameplay owner and let the new AnimBP read it.

Class and Skeleton compatibility

The New Class pin accepts an Anim Instance subclass. An Animation Blueprint's generated class also carries a target Skeleton contract. The target component needs a Skeletal Mesh whose Skeleton is the same or declared compatible.

Wrong combinations can leave the component without a usable main instance or pose and report validation/runtime warnings. The setter still has no Boolean result, so verify the live result:

Set Anim Instance Class(ABP_Desired)
-> Get Anim Instance
-> Is Valid
-> Cast To ABP_Desired

Do not use “the class pin connected” as proof of Skeleton compatibility. Test the exact Skeletal Mesh/AnimBP pairing, including modular character variants.

Passing no class removes the class needed for Animation Blueprint mode and can leave Get Anim Instance returning None. Use that deliberately, not as a temporary “pause” mechanism.

Configure defaults or switch at runtime?

Prefer component defaults when a mesh normally uses one Animation Blueprint:

Character Blueprint -> Body Mesh component details
    Animation Mode = Use Animation Blueprint
    Anim Class = ABP_Hero

That setup is serialized, visible to designers, initialized with the component, and easy to debug. Repeatedly assigning the same class in BeginPlay adds a reinitialization boundary with no benefit.

Use a runtime class switch only when the component truly changes animation program, such as a deliberately different creature form or vehicle mode. Even then, first ask whether these preserve state better:

  • one AnimBP with a gameplay enum/state input;
  • Linked Anim Graphs or Animation Layers for modular behavior;
  • a Montage/Slot for a one-shot action; or
  • single-node mode for a simple prop that never needed a locomotion AnimBP.

Replacing the entire class for every weapon/action is a heavy lifecycle choice, not a general “play this animation” node.

Construction, registration, and evaluation timing

Construction Script

Get Anim Instance is marked unsafe during Actor construction because the object is transient and may not exist yet or may be replaced later. Never serialize a Construction Script result into a variable and expect it to be the Play in Editor (PIE) instance.

Set stable Animation Mode/Anim Class defaults on the component. Use Force Init in Construction only for a proven editor/setup requirement, and still re-fetch the live object at runtime.

Runtime initialization

Obtain the reference in BeginPlay, Event Blueprint Initialize Animation, or a component animation-initialized callback after the component has initialized. If the mesh/class changes later, repeat the lookup/cast.

Active animation evaluation

Do not call Set Anim Instance Class from an Anim Notify or any path that can run while the current instance is evaluating. UE 5.8 explicitly rejects that call with a warning. A safe shape is:

Anim Notify / animation event
-> tell owning Actor that a switch is requested
-> Actor handles request after the animation update/evaluation boundary
-> Set Anim Instance Class on the game thread
-> re-fetch/cache the new instance after initialization

The white execution output is not a success result. Watch the Output Log and verify the returned class when debugging a switch.

Gameplay access and Animation Blueprint threading

Get Anim Instance, casting it, and changing mode/class are game-thread object lifecycle work. Do not call these nodes from Blueprint Thread Safe Update Animation.

For ordinary locomotion data, prefer this ownership direction:

Server/gameplay owner changes authoritative state
-> replicated Character/component variables reach relevant machines
-> each local AnimBP reads that state (Property Access or game-thread update)
-> each local mesh chooses its pose

Gameplay code may cache the live Anim Instance to call a presentation-specific function, but:

  1. get the exact mesh component;
  2. guard None and cast failure;
  3. call only from the game thread;
  4. invalidate/re-fetch after mesh, mode, or class changes; and
  5. do not make the AnimBP the authority for health, inventory, damage, or other gameplay state.

An Anim Instance exists separately on each machine that creates/animates that component. The UObject reference itself does not replicate. Set Animation Mode and Set Anim Instance Class are local calls, not RPCs. If all clients must see a form/class change, replicate the durable gameplay choice from the server and apply the presentation switch where those clients own their component copies.

When they fail (and what failure does)

Situation What you observe
Component target is None Blueprint invalid-reference diagnostic; call is skipped and Get's output remains default.
Component exists but has no initialized instance Get Anim Instance returns None silently.
Wrong mesh component chosen You get a valid instance for arms/face/outfit instead of the body, or None; no automatic search occurs.
Component uses single-node mode Get can return a single-node Anim Instance; Cast To the project AnimBP fails normally.
AnimBP class targets an incompatible Skeleton Initialization/validation can warn or leave no usable intended instance; there is no success pin.
Class change occurs during evaluation/Anim Notify Set Anim Instance Class warns and fails; defer the request.
Cached reference survives a class switch It may still be a valid UObject but no longer drives the component; compare/re-fetch.
Mode/class is changed on only one network machine Only that local component copy changes; remote presentation stays on its own state.
Same Animation Blueprint mode is forced to initialize Runtime variables/playback reset because a real reinitialization was requested.
Editor preview differs from PIE Preview and runtime components own different transient instances and owner relationships.

The pattern everyone actually uses

Stable Character setup:

Body Mesh defaults:
    Animation Mode = Use Animation Blueprint
    Anim Class = ABP_Hero

BeginPlay or other game-thread setup:
    BodyMesh -> Get Anim Instance -> Is Valid -> Cast To ABP_Hero
    cache only if the mesh/class will stay stable

AnimBP:
    Initialize Animation -> cache owner relationship
    Update/Property Access -> read gameplay-owned variables

Deliberate runtime swap:

Server changes replicated FormType gameplay state
-> each relevant local Character copy handles FormType change
-> choose compatible AnimBP class for that form
-> Set Anim Instance Class on BodyMesh outside evaluation
-> Get Anim Instance -> Cast to expected class
-> rebuild any presentation-only bindings/cache

The C++ twin, for the curious (our own example code):

USkeletalMeshComponent* BodyMesh = GetMesh();
BodyMesh->SetAnimInstanceClass(DesiredAnimClass);

if (UAnimInstance* LiveInstance = BodyMesh->GetAnimInstance())
{
    // Cast to the expected project subclass before using subclass behavior.
}

What these nodes do not do

  • Get Anim Instance does not create a missing instance or wait for one.
  • Set Animation Mode does not choose an animation asset or compatible AnimBP class for you.
  • Set Anim Instance Class does not preserve the old instance's runtime state.
  • None of them changes the Skeletal Mesh asset or fixes Skeleton incompatibility.
  • None of them is a Montage player, state-machine transition, animation pause, or ragdoll toggle.
  • None of them searches every Skeletal Mesh Component on the Actor.
  • None of them replicates an Anim Instance UObject or class change.
  • A successful cast does not make arbitrary cross-thread AnimBP access safe.

Lookalikes — which one do I want?

Node / setting Use when Key difference
Get Anim Instance Gameplay has a Skeletal Mesh Component and needs its live main animation object. Transient object; may be None or a different subclass.
Try Get Pawn Owner Code already runs inside an AnimBP and needs the Pawn owning that mesh. Opposite direction: Anim Instance to Pawn.
Anim Class component default This mesh normally uses one Animation Blueprint. Serialized, stable setup; preferred over redundant runtime assignment.
Set Anim Instance Class The component truly needs a different main AnimBP program at runtime. Replaces/reinitializes the live instance.
Set Animation Mode Switch between an AnimBP, one animation asset, or custom ownership. Chooses broad driver mode, not a Montage.
Play Animation A simple Skeletal Mesh Component should play one asset through single-node mode. Replaces normal AnimBP graph driving for that component.
Play Montage / Montage Play A one-shot action should run through a Slot in the existing AnimBP. Preserves the main AnimBP instead of replacing its class.
Link Anim Class Layers / Linked Anim Graph A main AnimBP needs modular runtime animation logic. Swaps linked portions rather than the entire main instance.
Get Post Process Instance You specifically need the mesh's post-process AnimBP. Not the main instance returned here.

Rule of thumb: configure one stable Anim Class by default; retrieve the live instance after initialization; replace the class only when the whole animation program truly changes.

Going deeper