I assigned a delegate, called TimelineDeal
, to call after each timeline tick but this delegate only gets called twice. I am calling TickTimeline()
in the actor’s tick. My timeline is set to play for 4 seconds, but whether it’s 4 seconds or 4000 seconds, the result is the same. Considering the timeline should tick every time the actor’s tick is called, I don’t know why it would stop after 2 times. Here is my code:
##.h
FTimeline TDeal;
FOnTimelineEvent TDealUpdate;
int32 TimelineDealCounter;
##.cpp
ASCard::ASCard(const FObjectInitializer& ObjectInitializer)
{
PrimaryActorTick.bCanEverTick = true;
TDeal = FTimeline();
TimelineDealCounter = 0;
...
}
void ASCard::Tick(float DeltaTime)
{
TDeal.TickTimeline(DeltaTime);
}
void ASCard::Dealing()
{
TDealUpdate.BindUFunction(this, FName("TimelineDeal"));
TDeal.SetTimelinePostUpdateFunc(TDealUpdate);
TDeal.SetLooping(false);
TDeal.SetTimelineLength(4.f);
TDeal.PlayFromStart();
}
void ASCard::TimelineDeal()
{
TimelineDealCounter++;
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::FromInt(TimelineDealCounter));
...
}
Dealing()
is called on this actor from my GameMode class.