ue-animation-system
Use when writing or debugging Unreal Engine animation C++: AnimInstance subclasses, thread-safe update, FAnimInstanceProxy, montage playback and delegates, anim notifies, animation curves, blend spaces, anim state machines, linked anim layers, root motion. Also use when the user mentions 'UAnimInstance', 'NativeUpdateAnimation', 'NativeThreadSafeUpdateAnimation', 'Montage_Play', 'OnMontageEnded', 'UAnimNotify', 'UAnimNotifyState', 'branching point', 'GetCurveValue', 'blend space', 'AnimGraph', 'LinkAnimClassLayers', 'motion matching', 'motion warping', 'root motion'. For movement and RootMotionSource, see ue-character-movement; for montage-driven abilities, see ue-gameplay-abilities.
quodsoler · Static checks on file
Installation
Read the source and dependencies before running a command. Copying does not install or execute anything.
npx skills add quodsoler/unreal-engine-skills --skill ue-animation-systemAbout this skill
name: ue-animation-system description: "Use when writing or debugging Unreal Engine animation C++: AnimInstance subclasses, thread-safe update, FAnimInstanceProxy, montage playback and delegates, anim notifies, animation curves, blend spaces, anim state machines, linked anim layers, root motion. Also use when the user mentions 'UAnimInstance', 'NativeUpdateAnimation', 'NativeThreadSafeUpdateAnimation', 'Montage_Play', 'OnMontageEnded', 'UAnimNotify', 'UAnimNotifyState', 'branching point', 'GetCurveValue', 'blend space', 'AnimGraph', 'LinkAnimClassLayers', 'motion matching', 'motion warping', 'root motion'. For movement and RootMotionSource, see ue-character-movement; for montage-driven abilities, see ue-gameplay-abilities." metadata: version: "2.0.0" engine: "5.8"
UE Animation System
Target engine: UE 5.8. APIs below are verified against the 5.8 headers; older forms are listed under "Deprecated — do not use".
Covers the runtime animation path in the Engine module — UAnimInstance, FAnimInstanceProxy, UAnimMontage, UAnimNotify/UAnimNotifyState, curves, blend spaces, anim state machines, linked anim layers and root motion — plus the animation plugins shipped in 5.8 (PoseSearch, MotionWarping, Chooser, IKRig, ControlRig, BlendStack, OptimusCore, UAF). Build.cs: Engine for everything under Runtime/Engine/Classes/Animation, AnimGraphRuntime for the helper anim nodes such as FAnimNode_LayeredBoneBlend; plugin module names are listed per row below.
Context
Read .agents/ue-project-context.md if it exists (module names, conventions, enabled plugins, GAS/networking setup). Do not stop if it is missing.
Identify the area from the request and the codebase. Ask only when two plausible readings would produce different code.
| Request is about… | Go to |
|---|---|
| AnimInstance subclass, thread-safe update, proxy | AnimInstance and Proxy |
| Playing/stopping montages, section jumps, end callbacks | Montages |
| Notifies, notify states, branching points, notify timing | Anim Notifies |
| Curve values, morph targets, curve metadata | Animation Curves |
| Blend spaces, state machines, aim offsets, layered blends | Blend Spaces and State Machines |
| Linked anim layers, per-mode locomotion swapping | Linked Anim Graphs and Layers |
| Root motion extraction and modes | Root Motion |
| Motion matching, warping, IK Rig, Control Rig, deformers | 5.8 Animation Plugins |
AnimInstance and Proxy
UAnimInstance (Animation/AnimInstance.h) runs in two phases. Game thread: NativeUpdateAnimation — safe to read gameplay state. Worker thread: NativeThreadSafeUpdateAnimation and blend-tree evaluation. Cache gameplay reads on the game thread; read only those cached values on the worker thread.
Verbatim virtuals (AnimInstance.h:1436-1457 public, :1716-1719 protected):
virtual void NativeInitializeAnimation();
virtual void NativeUpdateAnimation(float DeltaSeconds);
virtual void NativeThreadSafeUpdateAnimation(float DeltaSeconds);
virtual void NativePostEvaluateAnimation();
virtual void NativeUninitializeAnimation();
virtual void NativeBeginPlay();
virtual FAnimInstanceProxy* CreateAnimInstanceProxy(); // protected
virtual void DestroyAnimInstanceProxy(FAnimInstanceProxy* InProxy); // protected
FAnimInstanceProxy (Public/Animation/AnimInstanceProxy.h) is the worker-thread data container. Its override points are protected (:603-669):
virtual void Initialize(UAnimInstance* InAnimInstance);
virtual void PreUpdate(UAnimInstance* InAnimInstance, float DeltaSeconds);
virtual void Update(float DeltaSeconds) {}
virtual bool Evaluate(FPoseContext& Output) { return false; }
virtual void PostUpdate(UAnimInstance* InAnimInstance) const;
virtual void Uninitialize(UAnimInstance* InAnimInstance);
Reach the proxy with the protected templates GetProxyOnGameThread<T>() (:1746) and GetProxyOnAnyThread<T>() (:1769).
// MyAnimInstance.h
#pragma once
#include "CoreMinimal.h"
#include "Animation/AnimInstance.h"
#include "Animation/AnimInstanceProxy.h"
#include "MyAnimInstance.generated.h"
class ACharacter;
class UCharacterMovementComponent;
USTRUCT()
struct FMyAnimInstanceProxy : public FAnimInstanceProxy
{
GENERATED_BODY()
FMyAnimInstanceProxy() = default;
explicit FMyAnimInstanceProxy(UAnimInstance* InAnimInstance)
: FAnimInstanceProxy(InAnimInstance) {}
// Written on the game thread in PreUpdate, read on the worker thread in Update.
FVector Velocity = FVector::ZeroVector;
float Speed = 0.f;
bool bIsFalling = false;
protected:
virtual void PreUpdate(UAnimInstance* InAnimInstance, float DeltaSeconds) override;
virtual void Update(float DeltaSeconds) override;
};
UCLASS()
class MYGAME_API UMyAnimInstance : public UAnimInstance
{
GENERATED_BODY()
public:
virtual void NativeInitializeAnimation() override;
virtual void NativeUpdateAnimation(float DeltaSeconds) override;
virtual void NativeThreadSafeUpdateAnimation(float DeltaSeconds) override;
virtual void NativeUninitializeAnimation() override;
protected:
virtual FAnimInstanceProxy* CreateAnimInstanceProxy() override;
virtual void DestroyAnimInstanceProxy(FAnimInstanceProxy* InProxy) override;
UPROPERTY(Transient)
TObjectPtr<ACharacter> OwningCharacter;
UPROPERTY(Transient)
TObjectPtr<UCharacterMovementComponent> MovementComp;
UPROPERTY(Transient, BlueprintReadOnly, Category = "Locomotion")
float Speed = 0.f;
UPROPERTY(Transient, BlueprintReadOnly, Category = "Locomotion")
float Direction = 0.f;
UPROPERTY(Transient, BlueprintReadOnly, Category = "Locomotion")
bool bIsInAir = false;
};
// MyAnimInstance.cpp
#include "MyAnimInstance.
Read the complete source ↗