I want to know how to stop a running node when I type a certain key

Hello.Thank you for opening this page.

I am making a process to quit the game.
When you press the button on the widget, the QUIT GAME node will run, but add a delay node in between to create a waiting time.
If the space key is pressed during that waiting time, the process of quitting the game can be stopped and the game can be continued.
Please tell me how to do this.

Hi @anon75023769 , welcome to the forums.
You can use a timer instead of the delay node, which then can be cancelled.

K key triggers the ‘delay’ made by that timer.
L key allows to cancel out that timer, so the Event (your quit of the game) is not run

2 Likes

Thank you for your answer. I copied the blueprint you sent me exactly.
Then the problem was solved. thank you very much. But there is one problem.
When I changed the input to cancel from the L key to the space bar,
the cancel process was not executed.
If you press the spacebar, the same action will be performed one after another.
A similar phenomenon occurs when pressing a key to open a widget.
Please resolve this issue.

I didn’t know how to solve this problem, so I got away from it by using “set mode ui only”.
However, if you use this, BLUE PRINT will not receive all key inputs
when canceling the process of quitting the game earlier

I don’t know what to do anymore. Please lend me your wisdom.

Screenshot_2022.08.17_4

Since I am a new user, I could only put one media, so I will put another media here.

If the L key works and the Spacebar shows that effect, most likely the Spacebar is handled more than once. This can even be happen within the same blueprint

grafik

both prints are executed in the above case.

Please check, if your spacebar is used multiple times. If not in same blueprint, check other BPs as well. There’s a given hierarchy, the input is processed.

grafik

Edit: image from Input | Unreal Engine Documentation

So, the player Controller comes before the Level BP for example. And you can define, if an input should be consumed or not. So in the following image, the player controller reacts on the input K and does not consume it, means that the Level Blueprint and all are able to process it as well.

grafik

So you should check all places for this, where your space bar gets potentially processed.

I assume you are using keys directly only for testing, otherwise, defining input mappings makes life easier.

thank you very much!
I will try!