我想在角色动画结束时触发回调。但这对我不起作用。我是否会用它呢?还是我们有其他解决方案。请帮忙。
// SoldierCharacter.h
UFUNCTION(Category = "Callback")
void FinishedPlaying();
// SoldierCharacter.cpp
void ASoldierCharacter::BeginPlay()
{
Super::BeginPlay();
GetSprite()->OnFinishedPlaying.AddDynamic(this, &ASoldierCharacter::FinishedPlaying);
}
void ASoldierCharacter::FinishedPlaying()
{
if (GEngine)
{
GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Red, "Work");
}
}