Download

Can i get the owning pawn/character of a skeletal mesh via c++ ?

I get the mesh and the animationSequence from the Received_Notify function,
and i need to get the animationBlueprint that the current animation notifier was activated in.

This is the function i have in my class that extends UAnimNotify:


bool UEnemy_Hit_Notifier::Received_Notify(USkeletalMeshComponent* MeshComp, UAnimSequence* AnimSeq) const
{
	// Fill with whatever custom code and return value.
	return true;
}

You should be able to just call “MeshComp->GetOwner()” to get the owning actor.

Thanks man you are so awesome! :slight_smile:

I’ve inserted the event to the animation but it does’t get called, did i miss anything ?

66e0a893fe23aac5882b61a858cfc1011ac5c37d.png

This is the function that supposed to trigger and log something and it just won’t happen:


bool UEnemy_Hit_Notifier::Received_Notify(USkeletalMeshComponent* MeshComp, UAnimSequence* AnimSeq) const
{
	UE_LOG(LogTemp, Warning, TEXT("Animation Hit Notifying!"));
	AEnemy_Character* character = Cast<AEnemy_Character>(MeshComp->GetOwner());
	character->Hit_Notify();
	return true;
}

Unfortunately I don’t have a lot of experience with the animation notify system. Have you placed a breakpoint in that method and seeing if its in fact not getting called? My only other suggestion would be maybe toss this question on the UE4 AnswerHub and see if anyone from Epic has any ideas.

I will now do so, thanks for everything :slight_smile: