UMG Get Animation Current Time returns Zero

Please see the attached sample project that demonstrates the bug, which I’ve found in both 4.18 Preview 3 and 4.17.2.

Say you have a UMG animation that runs from time 0 to 1 (seconds). While the animation is playing, calls the Get Animation Current Time (on Tick) will return the accumulated animation time from 0 to 1. However once the animation finishes and reaches the end, Get Animation Current Time resets back to 0, even though the animation is at the end.

This bug makes it impossible to determine if an animation is at the start or the end. It also makes it impossible to create an animation that plays once (during Tick) and then stays at the end as shown in the sample project.

Are you saying this behaviour was different prior 4.17? Timelines do not reset but widget animations always did as far as I remember.

This bug makes it impossible to
determine if an animation is at the
start or the end.

UMG animations have onStart and onFinish events that fire providing start or finish were reached. Flag it with a bool in animation onFinish.

It also makes it impossible to create
an animation that plays once (during
Tick) and then stays at the end as
shown in the sample project.

You could store the current time in a float variable. You could Pause the animation. You can GetEndTime. Even though the animation time resets to 0, the animation result does persist.

I’ve been under the impression animation time resetting to 0 when ending was a feature rather than a bug but I’ve been wrong before more than once so who knows.

No, not suggesting it was different before 4.17, just that is the two versions that I found this in. First time I’ve tried using UMG animations and this just seemed like a glaring bug to me. Makes no sense why the animation time would reset to zero when the animation is at the end of the track.

I didn’t know about those events… will look into those. Your suggestions should solve the problems for me… but wow, what a lot of hassle that could all be avoided if the animation time would just reflect the animation’s track position. No need for events, setting bools, tracking time in a float, etc…

Hello wilberolive,

After taking a look at the project provided. This is working as intended. The reason you are seeing the current time reset to zero is because you call “Get current time” on the animation the frame after it finishes(because you are calling the event every frame). The animation is reset after the animation finishes so that it can be called again. As a test you could use the event “On animation finished” and you will see that when this is called the current time is the end time for the animation.

As a note: The animation on needs to be called once in order to play all the way through.

I hope that this information helps.

Make it a great day

1 Like

Hello

I have the same issue and I would love to take some more explanation of the solution.

Thanks :slight_smile:

Same Issue for me. It’s really strange that “Get Animation Current Time” don’t return the playhead position. It seems to return only the current time when animation is playing. But return 0 when animation is finished, it does not make sense.