Link to timelines doc for c++?

Hello everyone! I am just now diving into C++ from blueprints, and I use timelines a lot in blueprints and was wondering if they were in C++, and if so is there a doc I could use?

Hey Designer102-

You’ll want to look into using timers in code. The class for timers is Runtime/Engine/Public/TimerManager.h and there is a short tutorial on setting up an actor that uses a timer:

Let me know if this info helps.


Doug Wilson

The timer wont work for what I am trying to do, have a variable change overtime once a function is called, I am thinking of using a curve asset, is there a doc for that or any tips and tricks?

Unfortunately using a timeline in blueprints does not translate to code cleanly. If you are trying to change the value of a variable based on time then your best bet would be to use a time or to edit the variable in the Tick function so it will update with each tick.

I was actually planning to make it so a boolean is set to true in a function, then in the tick it will check for if the boolean is true and if so it will add to a float and if the float is over or at my wanted amount it will set the boolean to false, would that work?

That would work. Just keep in mind that while the bool is true, the float will increase every tick.

After trying this before I thought I give this timeline in c++ another shot. There are still some old answers here on answerhub which show how to use timelines in c++ with the actor’s own tick function. But actually it also works withouth using the tick of the actor. I had to use AddInterpFloat() at runtime to get this to run.

This answer should work for you!


UTimelineComponent* ScoreTimeline;

UCurveFloat* fCurve;

FOnTimelineFloat InterpFunction{};



static ConstructorHelpers::FObjectFinder<UCurveFloat> Curvy(TEXT("CurveFloat'/Game/Blueprints/NotSoImportant/CurveFloatBP.CurveFloatBP'"));
if (Curvy.Object) {
	fCurve = Curvy.Object;

ScoreTimeline = ObjectInitializer.CreateDefaultSubobject<UTimelineComponent>(this, TEXT("TimelineScore"));

InterpFunction.BindUFunction(this, FName{ TEXT("TimelineFloatReturn") });

//Then inside BeginPlay for example:

ScoreTimeline->AddInterpFloat(fCurve, InterpFunction, FName{ TEXT("Floaty") });
ScoreTimeline->Play(); // or PlayFromStart() etc, can be called anywhere in this class

//And Finally your callback function:

void AYourClass::TimelineFloatReturn(float val)
 //Your float val from curve returns here


I made a wiki page about this here:

U actually can use Timeline c++ in the same way as in blueprint withouth using a boolean or tick of the actor where the timeline is in. See my answer below.

I had to add UFUNCTION to the declaration of the “TimelineFloatReturn” function but otherwise this seems to work perfectly, thanks!

Hey @spaceharry, how would create your own curve in this, but where do you add value for it?

Hey @spaceharry, how would create your own curve in this, but where do you add value for it?

This still works beautifully today. I much prefer this, without having to call the progress function from within Tick, which never seemed right!