# Link to timelines doc for c++?

**URL:** <https://forums.unrealengine.com/t/link-to-timelines-doc-for-c/349439>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [March 3, 2016, 7:13pm UTC](https://forums.unrealengine.com/t/link-to-timelines-doc-for-c/349439 "2016-03-03T19:13:31Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_0c3ea6591](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0c3ea6591](https://forums.unrealengine.com/u/anonymous_user_0c3ea6591)\
**Post date:** [March 3, 2016, 7:13pm UTC](https://forums.unrealengine.com/t/link-to-timelines-doc-for-c/349439/1 "2016-03-03T19:13:31Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [March 3, 2016, 7:57pm UTC](https://forums.unrealengine.com/t/link-to-timelines-doc-for-c/349439/2 "2016-03-03T19:57:43Z")

</div>

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:

[https://docs.unrealengine.com/latest/INT/Programming/Tutorials/VariablesTimersEvents/1/index.html](https://docs.unrealengine.com/latest/INT/Programming/Tutorials/VariablesTimersEvents/1/index.html)

Let me know if this info helps.

Cheers

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0c3ea6591](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0c3ea6591](https://forums.unrealengine.com/u/anonymous_user_0c3ea6591)\
**Post date:** [March 3, 2016, 8:46pm UTC](https://forums.unrealengine.com/t/link-to-timelines-doc-for-c/349439/3 "2016-03-03T20:46:23Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [March 3, 2016, 9:30pm UTC](https://forums.unrealengine.com/t/link-to-timelines-doc-for-c/349439/4 "2016-03-03T21:30:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0c3ea6591](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0c3ea6591](https://forums.unrealengine.com/u/anonymous_user_0c3ea6591)\
**Post date:** [March 3, 2016, 11:52pm UTC](https://forums.unrealengine.com/t/link-to-timelines-doc-for-c/349439/5 "2016-03-03T23:52:26Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [March 4, 2016, 3:16pm UTC](https://forums.unrealengine.com/t/link-to-timelines-doc-for-c/349439/6 "2016-03-04T15:16:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![spaceharry](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@spaceharry](https://forums.unrealengine.com/u/spaceharry)\
**Post date:** [April 5, 2016, 9:33pm UTC](https://forums.unrealengine.com/t/link-to-timelines-doc-for-c/349439/7 "2016-04-05T21:33:59Z")

</div>

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!

//.h

```
UPROPERTY()
UTimelineComponent* ScoreTimeline;

UPROPERTY()
UCurveFloat* fCurve;

FOnTimelineFloat InterpFunction{};

```

//.cpp

//Constructor:

```
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:

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

---

<div class="post-metadata">

**Author:** ![spaceharry](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@spaceharry](https://forums.unrealengine.com/u/spaceharry)\
**Post date:** [April 7, 2016, 9:08am UTC](https://forums.unrealengine.com/t/link-to-timelines-doc-for-c/349439/8 "2016-04-07T09:08:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Torfi](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Torfi](https://forums.unrealengine.com/u/Torfi)\
**Post date:** [April 11, 2016, 2:42pm UTC](https://forums.unrealengine.com/t/link-to-timelines-doc-for-c/349439/9 "2016-04-11T14:42:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_8f31cd64](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8f31cd64](https://forums.unrealengine.com/u/anonymous_user_8f31cd64)\
**Post date:** [July 18, 2016, 5:09am UTC](https://forums.unrealengine.com/t/link-to-timelines-doc-for-c/349439/10 "2016-07-18T05:09:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_8f31cd64](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8f31cd64](https://forums.unrealengine.com/u/anonymous_user_8f31cd64)\
**Post date:** [July 18, 2016, 6:03am UTC](https://forums.unrealengine.com/t/link-to-timelines-doc-for-c/349439/11 "2016-07-18T06:03:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Slapdash85](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Slapdash85](https://forums.unrealengine.com/u/Slapdash85)\
**Post date:** [March 29, 2021, 7:36am UTC](https://forums.unrealengine.com/t/link-to-timelines-doc-for-c/349439/12 "2021-03-29T07:36:50Z")

</div>

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