RealDocs

UAnimInstance::TryGetPawnOwner

function Engine Blueprint Since 4.0
#include "Animation/AnimInstance.h"
Access: public Specifiers: virtualENGINE_APIUFUNCTIONBlueprintCallable

Description

Returns the Pawn that owns the skeletal mesh component driving this animation instance, or null if the owner is not a Pawn. Safe to call from the animation graph.

Caveats & Gotchas

  • Returns null if the owning actor is not a Pawn subclass — do not assume it always returns a valid pointer. Always check the result before dereferencing.
  • In linked animation instances (e.g., on a child skeletal mesh), this still returns the Pawn that owns the top-level skeletal mesh, not a 'nearest actor' search.

Signature

UFUNCTION(BlueprintCallable, Category = "Animation")
ENGINE_API virtual APawn* TryGetPawnOwner() const

Return Type

APawn*

Example

Read speed from pawn in BlueprintUpdateAnimation C++
void UMyAnimInstance::NativeUpdateAnimation(float DeltaSeconds)
{
    Super::NativeUpdateAnimation(DeltaSeconds);
    if (APawn* Pawn = TryGetPawnOwner())
    {
        if (UCharacterMovementComponent* Move = Pawn->FindComponentByClass<UCharacterMovementComponent>())
        {
            Speed = Move->Velocity.Size();
        }
    }
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.