Is button held down for a period of time, or quick pressed

whats a good and clean way to know if a button was pressed quickly or held down for a few seconds?

thanks in advance,

Don’t know that there is a straight forward way to do that, I have used “on pressed” and “on released” events with a timeline/timer to tell how long between the 2 events occurred.

Pull off the player controller, there is a 'Is input key down"

I would store the world/game Seconds on input Pressed,
then on input Released, I would subtract the stored world/game Seconds from the current one and then you have the amount of time it was held down and can branch based on whether it’s >= a certain amount of milliseconds.

On tick, place a Get Player Controller node, then connect it to a GetInputKeyTimeDown node. This will return how long a key is held down for. You can make a Branch node attached to your Tick node and if GetInputKeyTimeDown > 0 set a variable you make to the value. On the release of the key check the value of how long the key was held.

The node that is commented Time Held < Hold Time is there to see if the amount of time that the key was held is less than what you consider “held down”. If you set the bottom value to 1.0, then it will only consider it held down if it is held for one second or more.

Let me know if this helped!


1 Like

thanks for you comment but probably i need to go with the solution from mightyenigma since we use steamworks input interface and this doesn’t use Key variable but works with actions which returns a bool.