Timeline Not Reaching End Value
Hello all, so I updated to 4.21.1 yesterday and noticed my Event Graph wasn't working properly. Doing some quick troubleshooting I found that my looping Timeline was not actually reaching the desired number.
Here's what I mean: I have a timeline of length 1 with two keys set at (0,0) and (1,1). As it loops it should hit 1.0 and then begin the next loop; however it only reaches .99 before it resets.
In 4.19 (and maybe 4.20, never used that version) there was a bug in which the a looping Timeline would return 3 values every tick if it was set to 1 second. This made things difficult because if you wanted to add a value everytime the timeline reached 1, it would instead add that value 3 times. Luckily in 4.21.1 they fixed this bug.
"Bug Fix: TimelineComponent Update delegate will no longer execute three times when looping."
However this broke timelines completely because now, as stated, the timeline never reaches the end before it starts over. I've tried increasing the time to 1.01 but this results in the timeline skipping the end number randomly, and increasing it to 1.02 will sometimes skip it, sometimes hit it, and sometimes hit it twice. Very odd. I've also tried the opposite approach in setting my final key to return a value of 1.0 at .99 seconds, but that sometimes skips it too.
Any ideas how to work around this?
asked Dec 06 '18 at 04:04 PM in Blueprint Scripting
For anyone who faced the same issue of the timeline not being able to reach the end value, I've discovered a workaround. Specifically for trying to accelerate the timeline, as creating a second tick is not too difficult.
So what I did is pretty simple: Instead of using the timeline going from 0 to 1, then checking when it hits 1 and adding a second; what I do now is use real time seconds, truncate it into an integer, and then using a holder (set to a value of 0), I then compare the values.
When my Time Multiplier Preset is set to Real Time, it checks if there is a difference and then adds 1 to the "Sec Holder" thus allowing the process to loop and for there to always be a difference every second. If you don't do this then it will return a value every single tick. Which brings us to how we can accelerate time. If we use this error, if we set the Time Multiplier Preset to "Minute = 1 Second" we are now getting a smooth value increase every tick (essentially milliseconds instead of seconds), the difference here is that I don't add 1 after there is a difference therefore it will continues to find a difference every tick.
Hope this helps, if anyone had a similar issue!
EDIT/UPDATE: I found that using the error to get milliseconds results in a much faster time (faster than milliseconds) because it's returning false every tick, which happens much more frequently. The workaround is to do a similar setup as seconds, taking the fraction of seconds so that it is returning a 0 to 1 value regardless of where the second is at, then using that 0 to 1 value to lerp between 0 and 60 (59 in my case).
You'll still need to add 1 to the millisec holder after the branch that checks for a difference. Oh also if your clock is like mine you'll need to reset the millisec holder to 0 after every time increase. (i.e. if you're doing a minute every second, once seconds hits 60(59) reset the holder assuming you are also resetting the seconds) This will ensure there is time when the holder does equal time returning false.
Follow this question
Once you sign in you will be able to subscribe for any updates here