C++ access pawn from AnimNotifyState

I solve my problem on the forum:

We can do this to get it:

Cast<MyCharacter>(MeshComp->GetOwner());

Hey Guys,

I’m trying to catch the end of animation for my character and do something in c++ but i cannot acces pawn when notification happens.

#include "EmreAnimNotifyState.h"

DEFINE_LOG_CATEGORY(LogEmre)

UEmreAnimNotifyState::UEmreAnimNotifyState(const class FObjectInitializer& PCIP) : Super(PCIP) {
	UE_LOG(LogEmre, Warning, TEXT("emre: %s"), TEXT("initialized"));
}

void UEmreAnimNotifyState::NotifyBegin(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, float TotalDuration) {
	Super::NotifyBegin(MeshComp, Animation, TotalDuration);
	UE_LOG(LogEmre, Warning, TEXT("emre: %s"), TEXT("the start"));
}

void UEmreAnimNotifyState::NotifyEnd(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation) {
	Super::NotifyEnd(MeshComp, Animation);
	UE_LOG(LogEmre, Warning, TEXT("emre: %s"), TEXT("the end"));
}

This is the code i have for end of the notification which i don’t know hot to call my pawn simply or on initialiozation set the pawn reference to this class/object somehow? i don’t wanna iterate over all players/pawns/actors to find the right one there should be a way to access directly the pawn or current character that we play.