How to get Character within UAnimNotify

I cam across the [this][1] thread

I subclassed UAnimNotify and overrode Notify.

However, now I don’t understand how to get things from within Notify that I need. For example the current Character.

In the Animation BP I can get the pawn easily from the AnimInstance

However, I don’t see a way to get the AnimInstance within UAnimNotify.

UCLASS()
class FPSGAME_API UFPSTriggerAbilityAnimNotify : public UAnimNotify
{
	GENERATED_BODY()
	
    virtual void Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation) override;

};

void UFPSTriggerAbilityAnimNotify::Notify(class USkeletalMeshComponent* MeshComp, class UAnimSequenceBase* Animation)
{
    Super::Notify(MeshComp, Animation);

    // How do I get character here?
}

You should be able to use the Mesh Component’s owner to get your character, like so:

AActor* AnimationOwner = MeshComp->GetOwner();
if (AFPSCharacter* Character = Cast<AFPSCharacter>(AnimationOwner))
{
    // Do stuff
}

Works like a charm :slight_smile: For some reason I thought that wasn’t the actual instance of the skeletal mesh.
I misinterpreted this line in the docs

SkeletalMeshComponent is used to create an instance of an animated SkeletalMesh asset.

Thank you!