Call press and hold button via blueprint

Hi all, why sae engine press “X” button without input event. I know how work with event and user input, but problem if I need simulate user input and execute “Press any button and HOLD” via blueprint.
I try via event tick, but button press without hold

You can simply open the Gate when you press the key, and close it upon release.

Or set a bool wariable to True/False, and do what you need while it is True.

What is the action you want to execute after the ley is held down for some time? You can use Tick, Gate and a float variable — add Delta seconds to the float on each tick and check if it’s more than, say, 3 seconds; and when the key is released — set float to 0;

Or upon presing the key start a Timeline with a curve that goes from 0 to 1 in 3 seconds, and check if the value is 1. The same curve may be used to drive some animation like a progress bar.

I know, but it not work, button press without hold.

we have custom logic in our project and all work via event “Any key press”, but this event wait when user relese button, as I sae befor via event tick event it not work if you look on image you will see gate node. I want sae engine (hold this button)? I want simulate “event any key press”.

Hi, you can try one of those solutions:

The first one (F key) invoke your methods ONLY at button release.

The second one (E key) invoke your hold method if the time has passed, the normal method at release (if the hold didn’t get invoked).

1 Like

Hi Iohoilpotere, thank for support, but this solution will work if you press key or use input. I need sumulite hold without any keybord, in my functional tests I save all user input in array and send it to server, but when I execute press button event I need sae server hold button, I can not use epic event.

I work only with “code” without any input (keyboard or gamepad). In other words, I want call “any key” event via blueprint when game run. Sorry for my english.

Hi, UE4.27

This worked for me to fire the events, Normal or Hold. Hold is 0.5.

But it is firing Normal twice (on press and release). And my Normal is connected to a toggle (to enter a vehicle - so when Im already inside and press E to exit - on Release E, it puts me back in).

So how do I limit it so the Normal only fires once? I tried adding delay 0.2 but dont know where. Ty