Get current time from Timeline

Is there any way to do this?

Personally, I want to use it to save the current time and load it later with Set New Time. I already have a workaround, but could be much cleaner with Timeline.

Like a timer? Theres no way in blueprints that I’m aware of.

In C++ theres alot you can do quite simplly and throw it on a simple actor or bpfunctionlib class. You could use the remaining/elapsed time. Ramas victory node uses this code for a lot of nodes such as TimeSinceCreation but not in that I’m thinking your thinking.

Timers are managed in a global FTimerManager, outside the confines of AActor, and can have any of the full range of delegate types assigned. There are several functions in FTimerManager available for managing timers. It is safe to use these functions inside of a timer delegate as the system is ok with manipulating timers while handling a timer. This means, for example, it is ok to set or clear timers inside a timer delegate.

The AActor::GetWorldTimerManager() function is used to access the timer manager instance for the current world.

Creating and Clearing Timers

FTimerManager::SetTimer() is used to create a timer to call the given native function at a set interval.

Example:

GetWorldTimerManager().SetTimer(this, &AMatineeActor::CheckPriorityRefresh, 1.0f, true);

SetTimer() can also reset an existing timer. So, if a timer is already set for this delegate, it will update the current timer to the new parameters and reset its elapsed time to 0.
FTimerManager::ClearTimer() clears a previously set timer so it will not execute any more.

Example:

GetWorldTimerManager().ClearTimer(this, &AMatineeActor::CheckPriorityRefresh);

Clearing a timer with ClearTimer() is identical to calling SetTimer() with a <= 0.f rate.
Pausing Timers

FTimerManager::PauseTimer() pauses a previously set timer in its current state. This means it will not execute, but the elapsed and remaining time stay the same until the timer is unpaused.

FTimerManager::UnPauseTimer() sets a paused timer active once again.

Timer Information

In addition to managing timers, FTimermanager also provides funtions for obtaining information - such as timer rate, elapsed time, remaining time, etc. - about a specific timer.

Is Timer Active

FTimerManager::IsTimerActive() is used to determine if the specified timer is curently active and not paused.

Example:

GetWorldTimerManager().IsTimerActive(this, &APlayerController::DelayedPrepareMapChange)

Timer Rate

FTimerManager::GetTimerRate() gets the current rate (time between activations) for the specified timer.

Example:

GetWorldTimerManager().GetTimerRate(this, &AUTWeapon::RefireCheckTimer)

Elapsed and Remaining Time

FTimermanager::GetTimerElapsed() and FTimerManager::GetTimerRemaining() return the elapsed and remaining time, respectively, for the specified timer.

Example:

GetWorldTimerManager().GetTimerElapsed(this, &AUTWeapon::RefireCheckTimer)
The sum of the elapsed and remaining time for a timer should be equal to the rate of the timer.
Timer Function Overloads

Each of the timer-manipulation functions has 3 flavors of overloads for interacting with timers.

Taking an object and a function.

GetWorldTimerManager().SetTimer( this, &UMyClass::DoSomethingWithNoParams, 5.f, FALSE );

This is the simplest form and the closest to the older system. It is identical to

GetWorldTimerManager().SetTimer( FTimerDelegate::CreateUObject(this, &UMyClass::DoSomethingWithNoParams), 5.f, FALSE );

It is a bit redundant, but it is cleaner and expected to be the most common use case.
Taking any type of non-dynamic delegate you can muster. It is a bit muddier syntactically but far more flexible. e.g.

GetWorldTimerManager().SetTimer( FTimerDelegate::CreateUObject(this, &AMyClass::MyFunc), 5.0f, TRUE );
GetWorldTimerManager().SetTimer( FTimerDelegate::CreateRaw(&MyStaticFunc, MyPassThruArg, MyOtherArg, YesOneMoreArg), 5.0f, TRUE );

FTimerDelegate MyDel;
Del.BindRaw(this, &AMyClass::MyFunc2);
GetWorldTimerManager().SetTimer( MyDel, 5.0f, TRUE );

Taking a dynamic (i.e. UFunction) delegate.

FTimerDynamicDelegate D;
D.BindDynamic( this, &AMyClass::MyUFunction );
GetWorldTimerManager().SetTimer( D, 5.0f, TRUE );

These delegates are called via the UFUNCTION event mechanism, meaning they will properly respect things like non-native overrides such as in Blueprints.

Known Issues

The code is not threadsafe at the moment. It will cause an assert if accessed outside the game thread.

Don’t forget to accept an answer that best clears your question up or answers it so when the community finds your question in the future via search/google they know exactly what you did to fix it/get it going.

Sounds like you need Get Playback Position.

A timeline is a normal variable in your Blueprint, so when saving your Blueprint you can easily access it (even within a function) and use the Get Playback Position node to get the timeline’s current time.

Note that the timeline position does not get automatically reset when it completes, so querying the time after it has
finished will still return the final time.

When loading your Blueprint, you can then feed this time back into the Timeline using the Set New Time and Play nodes.

You can also use the Set Playback Position node instead, which also allows control over whether skipped events should fire or not.

Here’s some documentation about timelines:

https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/Timelines/TimelineNodes/index.html

I didn’t even thought about timeline being a variable, which is great, so many possibilities…

Thank you :wink:

thanks for sharing