How to use UTimelineComponent.SetTimelinePostUpdateFunc

Finally got it working by

In my racer.h:

	UPROPERTY(BlueprintReadWrite, Category = "Spline Racer")
		FOnTimelineEvent TimelineEventEvent;

	UPROPERTY(BlueprintReadOnly, Category = "Spline Racer")
		FOnTimelineFloat TimelineFloatEvent;

	UFUNCTION(BlueprintNativeEvent, Category = "Spline Racer")
	void OnEventEvent();

	UFUNCTION(BlueprintNativeEvent, Category = "Spline Racer")
	void OnFloatEvent(float UpdatedValue);

In my constructor:

	TimelineEventEvent.BindDynamic(this, &ASplineRacer::OnEventEvent);
	TimelineFloatEvent.BindDynamic(this, &ASplineRacer::OnFloatEvent);

Lower in my cpp:

void ASplineRacer::OnEventEvent_Implementation()
{
	// print("Event Event");

	 //Do nothing!
}

void ASplineRacer::OnFloatEvent_Implementation(float UpdatedValue)
{
	// print("Float Event" + FString::SanitizeFloat(UpdatedValue));

	// Base movement code here!
}

Other things included:

Setting up the Curve:

		TimelineComponent->AddInterpFloat(Curve, Racer->TimelineFloatEvent, FName("Percentage_Complete"));

Setting the PostUpdatefunc:
UTimelineComponent* Timeline = Racer->TimelineComponent;

		Timeline->SetTimelinePostUpdateFunc(Racer->TimelineEventEvent);
1 Like