Can I break or cancel a delay node?

Technically you can’t cancel or break a delay node, unless you’re using C++. But there is a way to re-route the delay node so it triggers different actions. This requires the use of switches, bools and other nodes that in all intent and purposes will break the delay node.

Below is an example of a Blueprint I created that didn’t work as required to start with, but after some additional logic I got it working as was required.

Auto Light On or Off: Initial Blueprint.

I’d created a simple ‘auto – on or off’ blueprint where if the player entered the (begin overlap) collision box it turned on a light. The light would then be triggered to turn off when leaving the (end overlap) collision box. To make this a little more realistic I added a delay node to stop the light turning off immediately. See code below:

The components added for this are just a point light, collision box and a static mesh for the lamp shade.



The problem I encountered was if I quickly re-entered the collision box before the delay executed, the light would turn off with the player character still in the collision box. Hence leaving the logic functioning incorrectly.


The simple solution would be to just cancel the delay, but there is no way to do that in Blueprints.


Auto Light On or Off: Updated Blueprint with more advanced Logic:

So I created a switch and branch to circumnavigate the delay if the player re-entered when the delay was still counting down and if the light was still on.

To do this I added a switch (Boolean variable) where if the player re-entered the collision box whilst the delay node was still running, this would flick a switch to re-route the delay node to keep the light on, as opposed to turn the light off. See the final version and a detailed outline of the code below:

Logic: The > arrow represents the flow of the nodes in the graph above.

  1. Player enters the (Begin Overlap) collision box > Triggers the Branch.
    1. Branch Condition: I added the Is Visible node > The target of this is the point light and this checks if it’s Visible.
      1. I created a Boolean Variable and called it: Stop Auto Off
    2. So if Light is Visible > Then Branch = True > Set Boolean Switch (Stop Auto Off) to False (as its set to True initially) > Set Visibility to Visible (make sure Visibility box is ticked as in the image).
    3. If not visible > Then Branch = False > Set Visibility to Visible. 
  2. Player leaves collision box and triggers the Delay.
    1. Then Triggers another Branch.
    2. Condition = True or False
    3. If True > Set Visibility to On > Set Stop Auto Off to false (leave the box unticked in the Boolean node).
    4. If False > Set Visibility to Off.

In summary:

When the player enters the collision box it checks if the light is on (visible) if it is then flick a switch and this will simply change the action for when the player leaves the collision box. Hence trigger the delay to turn the light off when the player leaves or if the player remains under the light then keep the light on!

See the Logic In Action below:


Key Notes:

This is one way to re-route a delay node and you may have to tweak or amend the logic for your purposes, but this should give you a way forward. Also it may seem a little unnecessary for the the first branch to both end on the same result (Light on). But this is necessary just to flick the Boolean switch, so the light stays on if a player enters the collision box even if the delay is running.

If you have any comments or suggestions please do say.

For further tutorials on blueprints please see the page here: Blueprint Tutorials or to get started with blueprints please see here: Get Started with Blueprint