Timeline firing both Update and Finished at same time.

I have a sliding door and setup a timeline for the opening (Play) and closing (Reverse) of the doors. But for some reason, the first time I trigger the timeline, it wants to trigger the Update and Finished at exactly the same time. I can see the door start to open for a split second, then immediately go to the finished code and reverse.

I managed to fix it (See attached screenshot) by separating my Timeline out and just calling the individual Play and Reverse functions separately, but I’m wondering is this a bug? And has anyone else seen this behavior?

There’s nothing special here. It’s just a simple sliding door like you’d see in a grocery store or other location. A Begin Overlap triggers the initial opening (Play). And then every second it checks to see if there are any Characters inside the trigger box. If there are, then it waits for a second and checks again. Finally, if there are no more characters inside the trigger, it calls the Reverse function to close the door.

Again, this screenshot is my fix. I didn’t bother to post the original shot, because there wasn’t anything meaningful. Just imagine the normal Timeline after the Cast To Character, and both the Update and Finished pins firing together.

1 Like

It works much better if you just plug begin overlap into Play, and end overlap into Reverse on the timeline.

Also, what you have here, will trigger Reverse forever :slight_smile:

doors

1 Like

Yes, that is the easy way when only having to deal with a single person going through. But the reason I can’t do that is because there may be multiple people going through the door at the same time, so when the first one through triggers the end overlap, the door will close on the second one.

Also, no on the forever. Once there are no Characters within the trigger box, the branch terminates. The reverse is played only once. You can see that there is no further execution after the reverse is played. The only loop is for checking every second to make sure the door is clear before closing.

The solution I came up with is tight, efficient, and works.

I’m just wanting to know why a Timeline would fire the Update and Finished at exactly the same time instead of the finished pin waiting for the timeline to actually finish before firing.

But thanks! :slight_smile:

1 Like

Ok, now the facts :smile:

I might come back with something else later…

I just read this again. Sorry, I was wrong on the forever.

But doesn’t the overlap fire again, if someone else comes along?

I’m thinking that the Finished would probably be in the same, or next, frame as the last call to Update.

Once the begin overlap fires, it can fire off as many opens as it wants since I’m using the Play and not the Play from Start.

In the interim, it loops through every second checking to make sure that the number of “character” classes that are overlapping with the collision box is greater than zero, then it only fires the reverse when it comes back with zero.

I’m casting to the generic “Character” class (and also checking for just “Character” classes), and not a more specific character (i.e. BP_ThirdPersonCharacter) so that it doesn’t matter if it’s the player, and NPC, or any other “character” derivative that’s overlapping.

I wanted to post this, mostly so that if other people are having the same issue they can see a possible solution, and also to see if anyone knows if it’s a specific bug somewhere. I just have absolutely no idea why the timeline would fire Update and Finished at the same time.

It just occurred to me that I could have tried to use the Event Begin Play to just hit the Set New Time to 0 in case the time pointer was off somehow at the start.

1 Like

You can really do without the delay and getting all overlapping actors with a simple counter:

About the update and finish - I think it is called all the time when the timeline is at its end weather it is playing or not. In my case I get it triggered each tick of the timeline even before anything has entered the trigger.

Maybe you could guard it with DoOnce()node but in the end I don’t think you need any code there.