Download

FTimeline update and finished callbacks not firing in C++

There’s a bunch of post on the AnswerHubs and some in the forums on how to use FTimeline but none help me out.

Basically I wish to connect the update and finished callbacks for a vector based FTimeline. They are not being called.

In my header I have my Timeline and update callbacks.

I believe I have the signature correct for the update function. - DECLARE_DYNAMIC_DELEGATE_OneParam( FOnTimelineVector, FVector, Output );



UPROPERTY()
FTimeline Timeline;
void DoorTimelineUpdate(FVector Output);


Then in PostInitializeComponents() I have:



if (AnimationCurveWorking)
{
        Timeline.AddInterpVector(AnimationCurveWorking, FOnTimelineVector());

	FScriptDelegate updateDelegate;
	updateDelegate.BindUFunction(this, TEXT("DoorTimelineUpdate"));
	Timeline.SetTimelinePostUpdateFunc(FOnTimelineEvent(updateDelegate));
}

....

void AVSDoor::DoorTimelineUpdate(FVector Output)
{
	if (Role == ROLE_Authority)
	{
		GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("door updating"));
	}
}


I then *Tick * the timeline - Timeline.TickTimeline(DeltaSeconds);

Stepping through the timeline I can see it working and it gets to the area where callbacks are called. It just never ends up in my function - DoorTimelineUpdate

The only place in the code I can see this being used is for Blueprints - https://github.com/EpicGames/UnrealEngine/blob/69b5693c869697b828e1f2c24004ff1481b5fb98/Engine/Source/Runtime/Engine/Private/BlueprintGeneratedClass.cpp#L365

Is this something that is Blueprint-centric only?
Is there another way to achieve a moving door in C++?

I like the timeline method as it’s data driven.

Screw it, going old school:


FMath::VInterpTo