UAnimInstance::NativeUpdateAnimation
#include "Animation/AnimInstance.h"
Access: public
Specifiers: ENGINE_APIvirtual
Description
Override in C++ subclasses to update animation variables every frame. This is the primary per-frame hook for driving animation state from gameplay — set variables here that your animation blueprint reads in its graph.
Caveats & Gotchas
- • Always call Super::NativeUpdateAnimation(DeltaSeconds) to ensure base class logic runs (including propagation to linked instances if configured).
- • This runs on the game thread before the parallel update. For thread-safe math that can run off the game thread, consider NativeThreadSafeUpdateAnimation or ParallelUpdateAnimation instead to reduce game thread cost.
Signature
ENGINE_API virtual void NativeUpdateAnimation(float DeltaSeconds); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| DeltaSeconds | float | Time elapsed since the last animation update. | — |
Return Type
void Example
Update movement variables for anim graph C++
void UMyAnimInstance::NativeUpdateAnimation(float DeltaSeconds)
{
Super::NativeUpdateAnimation(DeltaSeconds);
if (APawn* Pawn = TryGetPawnOwner())
{
Speed = Pawn->GetVelocity().Size();
bIsInAir = Pawn->GetMovementComponent()->IsFalling();
}
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?