Hello,
I am having issues in UE4.20.2 where my TimelineUpdate function is never getting called when I play the Timeline. I am checking the timeline in the debugger right before I call Play() and I see the RecoilUpdate function under the InterpFloats so it is added to the timeline. (Image about debugger attached to post)
My header file has the following functions/variables:
UTimelineComponent* RecoilTimeline;
UPROPERTY(EditDefaultsOnly, Category = "Recoil")
UCurveFloat* Curve;
FOnTimelineFloat TimelineUpdate{};
FOnTimelineEvent TimelineFinished{};
void RecoilUpdate(float Value);
void RecoilFinished();
My cpp file has the following functions:
ASWeapon::ASWeapon()
{
RecoilTimeline = NewObject<UTimelineComponent>(this, FName("TimelineAnimation"));
}
void ASWeapon::BeginPlay()
{
Super::BeginPlay();
if (Curve)
{
TimelineUpdate.BindUFunction(this, FName{ TEXT("RecoilUpdate") });
TimelineFinished.BindUFunction(this, FName{ TEXT("RecoilFinished") });
SCREEN_LOG_DETAILED(TEXT("Curve Assigned to timeline"));
RecoilTimeline->AddInterpFloat(Curve, TimelineUpdate, FName{ TEXT("Value") });
RecoilTimeline->SetTimelineFinishedFunc(TimelineFinished);
RecoilTimeline->SetLooping(false);
RecoilTimeline->RegisterComponent();
}
}
void ASWeapon::RecoilUpdate(float Value)
{
SCREEN_LOG_DETAILED(TEXT("Recoil Update"));
}
void ASWeapon::RecoilFinished()
{
SCREEN_LOG_DETAILED(TEXT("Recoil Finished"));
}
void ASWeapon::PlayFireEffects() {
RecoilTimeline->Play();
}
}
PlayFireEffects gets called and calls the Play function but nothing else gets called. The debugger snapshot attached shows the function inside the timelime. Any help would be greatly appreciated. Thanks.