UAnimInstance::NativeInitializeAnimation
#include "Animation/AnimInstance.h"
Access: public
Specifiers: ENGINE_APIvirtual
Description
Override in C++ subclasses to perform custom initialization when the animation instance starts. Called once during InitializeAnimation after the anim graph nodes are set up. This is the primary C++ initialization hook for animation blueprints.
Caveats & Gotchas
- • Always call Super::NativeInitializeAnimation() at the start of your override to ensure base class initialization completes properly.
- • The owning component and actor are valid at this point, but the world may not be fully loaded if called during level streaming. Cache references here but defer complex world queries to NativeUpdateAnimation.
Signature
ENGINE_API virtual void NativeInitializeAnimation(); Return Type
void Example
Cache references in initialization C++
void UMyAnimInstance::NativeInitializeAnimation()
{
Super::NativeInitializeAnimation();
OwnerCharacter = Cast<AMyCharacter>(TryGetPawnOwner());
if (OwnerCharacter)
{
MovementComponent = OwnerCharacter->GetCharacterMovement();
}
} See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?