RealDocs

UAnimInstance::NativeBeginPlay

function Engine Since 4.14
#include "Animation/AnimInstance.h"
Access: public Specifiers: virtual

Description

C++ lifecycle hook called when the owning skeletal mesh component's BeginPlay fires. Override in a C++ anim instance subclass to perform one-time setup that requires the world and component to be fully initialized.

Caveats & Gotchas

  • Always call Super::NativeBeginPlay() in your override. The base implementation triggers BlueprintBeginPlay, so skipping Super will silently suppress the Blueprint event.
  • GetSkelMeshComponent() is safe to call here, but the mesh's physics state and owner actor may still be in early initialization. Defer anything requiring fully initialized physics to the first NativeUpdateAnimation call.

Signature

ENGINE_API virtual void NativeBeginPlay();

Return Type

void

Example

Caching owner reference in C++ anim instance C++
void UMyAnimInstance::NativeBeginPlay()
{
    Super::NativeBeginPlay();

    // Cache owner pointer once; reuse cheaply each tick.
    OwnerCharacter = Cast<AMyCharacter>(GetSkelMeshComponent()->GetOwner());
}

Version History

Introduced in: 4.14

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.