Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

(Problem) Variable Prints 3 Times Per Tick

Hello Everyone,

So my problem put simply is this. I have a Timeline in UE4 Event Graph running from 0 to 1 on loop. I have some presets that will manipulate the playrate, i.e. if the preset it set to "Real Time" it will set the playrate to 60 and every time the Timeline reaches 1, it will increase my variable called "Milliseconds" by 1, and every time Milliseconds equals 59, it will add 1 to my variable called "Seconds" then reset Milliseconds to 0. It continues on for Minutes and Hours respectively. All of this happens inside of a blueprint function.

alt text

The clock works great, but here's the problem. If I tell it to print out Seconds inside the function, it will do just that. (0 to 59); however if I ask it to print out Seconds OUTSIDE the fuction (In the Event Graph) It will print out each number THREE times. (0,111,222,333, ect.) So later on I call the variable, normalize it to a range so it gives me 0 at 0 seconds, and then 1 at 59 seconds, and then plug that value into a branch "When Seconds, normalized, equals 1, Do this thing..." It will do that thing THREE times. Ex. When seconds, normalized, equals 1, add 1 to Variable "A." Instead of adding 1 it adds 3.

alt text (I blacked out some nodes to make it easier to read)

Does anyone know what is causing this, and either a way to fix it or a work around. I tried creating a local clock within the second function, and that worked, but I don't want to have to create a bunch of local clocks when I have a global clock that is exactly what I need. I've also tried a "Do Once" node inside the function, and that didn't do anything. My theory is that it has to do with a looping timeline. When I tried to print the alpha of the timeline, it would give me "0.0, (Random number inbetween 0 and 1), 1.0"

Any thoughts?

Product Version: UE 4.19
clockfunction.jpg (297.5 kB)
more ▼

asked Oct 29 '18 at 02:56 PM in Blueprint Scripting

avatar image

16 3 2 4

avatar image Zerzuskan Nov 16 '18 at 04:31 PM

well there is a bit of context missing (for example where do you print that number), but you described that your do once isnt doing anything.

I guess you used that Do Once inside a function. Well each time you call your function all local variables get resetted, so if you call that do once twice in two different function call, it counts as not called in that function call.

If you would call it twice in the same call, then it would remember that it was already called

avatar image ReclusiveRychu Nov 16 '18 at 05:56 PM

I solved the problem by just creating a new clock inside the function. I was printing it to the screen on play, and yeah the Do Once node doesn't work properly inside a function because of what you mentioned. Either way the Print and the Do Once aren't the root problem. The print just confirms that the action is happening 3 times every tick.

The initial problem still remains though. Don't know why it was doing the action three times rather than once. Clock is running inside a function, that function gets called every tick, relaying information to another function, but that function is getting an input 3 times a tick. It's very odd considering all my other functions receiving the same information from the clock only act once. It's a conundrum.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hey! So this bug was fixed with 4.21.1!

"Bug Fix: TimelineComponent Update delegate will no longer execute three times when looping."

Unfortunately it broke the timeline too. R.I.P. If you set the length of the timeline to 1 and having two points going from 0,0 to 1,1; the timeline will never actually reach 1. So when checking if the alpha reaches one it will return False.

more ▼

answered Dec 06 '18 at 03:40 PM

avatar image

16 3 2 4

avatar image ReclusiveRychu Dec 06 '18 at 03:46 PM

Increasing the timeline to 1.01 will sometimes still miss hitting 1, and increasing it to 1.02 seconds will sometimes return 1 twice. There's no way to win here.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question