I’m using FTimeline to interpolate a float value. Everthing is working fine except calling a function once timeline finishes. Tried multiple ways but nothing worked. Below is my code
Header file
UPROPERTY()
FTimeline MyTimeLine;
UFUNCTION()
void HandleMyTimeLine(float Value);
void FinishMyTimeLine();
UCurveFloat * MyCurveFloat;
CPP file: in BeginPlay
FOnTimelineFloat MyTLFunction;
MyTLFunction.BindUFunction(this, FName("HandleMyTimeLine"));
MyTimeLine.AddInterpFloat(MyCurveFloat, MyTLFunction);
MyTimeLine.SetLooping(false);
// Timeline finish method
FOnTimelineEvent MyTLFinishFunction;
MyTLFinishFunction.BindUFunction(this, FName("FinishMyTimeLine"));
MyTimeLine.SetTimelineFinishedFunc(MyTLFinishFunction);
In Tick
if (MyTimeLine.IsPlaying()) // Tried by removing this condition
MyTimeLine.TickTimeline(DeltaSeconds);
// Methods
void AMyCharacter::HandleMyTimeLine(float Value)
{
// Do something
}
void AMyCharacter::FinishMyTimeLine()
{
// Do something
}
With input calling
MyTimeLine.PlayFromStart();
The above code works fine and HandleMyTimeLine method is getting called multiple time but Finish method is never getting called. Not sure how to get finish method called. Checked multiple posts in Answers hub, forums and in internet but nothing helped. Please help me to resolve this and thanks in Advance
Thanks,