C++ AnimNotifyState functions not being executed

Hey all,

I’m having trouble getting C++ AnimNotifyState to work. All I’ve done is created a child class of UAnimNotifyState, overridden Received_NotifyTick, and try printing out whenever it is executed. In blueprints I got it to work right away, this is what the function looks like (yes, it is a different class from my C++ one):

Here is my header code:

#include "CoreMinimal.h"
#include "Animation/AnimNotifies/AnimNotifyState.h"
#include "AnimNotifyState_AnimationState.generated.h"

class PROJECT_API UAnimNotifyState_AnimationState : public UAnimNotifyState

	virtual bool Received_NotifyTick(USkeletalMeshComponent * MeshComp, UAnimSequenceBase * Animation, float FrameDeltaTime) const;

Here is my source code:

#include "AnimNotifyState_AnimationState.h"
#include "Kismet/KismetSystemLibrary.h"

bool UAnimNotifyState_AnimationState::Received_NotifyTick(USkeletalMeshComponent * MeshComp, UAnimSequenceBase * Animation, float FrameDeltaTime) const
	//Super::Received_NotifyTick(MeshComp, Animation, FrameDeltaTime);
	UKismetSystemLibrary::PrintString(MeshComp, "works");
	return false;

What could I be missing? It works fine in BP, and all I’m doing outside of the C++ code is literally replacing the same anim notify that I made in BP with the one I made in C++, so the issue is definitely in the code.

Thanks for any help!

Could it be I’m missing a module or an include or something? Maybe add something in the constructor…? I can’t figure it out :frowning:

did you add start and stop notify on your animation?

recommended function to be used instead Received (they are for blueprints)

void UEmreAnimNotifyState::NotifyBegin(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, float TotalDuration) {
	Super::NotifyBegin(MeshComp, Animation, TotalDuration);

void UEmreAnimNotifyState::NotifyEnd(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation) {
	Super::NotifyEnd(MeshComp, Animation);

Yep, that actually worked. I feel like an idiot now! I was following this guide and he used Received_NotifyBegin so I went with that. Clearly that was a mistake, thanks for the help.