OnFinishedPlaying do not work in c++!

I try to get the OnFinishedPlaying event a 2d project write by c++,but it do not work,
here is the use code:

GetSprite()->OnFinishedPlaying.AddDynamic(this, &AFDGameCharacter::FinshPlaying);

And the callback function is:

void AFDGameCharacter::FinshPlaying()
{
	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("attack"));
}

But this callback never called!
Can someone tell me how to use this?
Thanks!

1 Like

in Hader file

UFUNCTION(Category = "CallBack")
void FinshPlaying();

Perhaps you did not declare a UFUNCTION.

Sorry. My bad english.

1 Like

@Junee thank you!

Adding UFUNCTION() above my function declaration in the header file made OnFinishedPlaying.AddDynamic(this, &MyClassName::MyFunctionName) properly trigger thanks :slight_smile: