I tried to figure this out for about half a day now without getting any closer to a solution, so I ask you guys now.
This is the situation: I want to create an exit menu, which allows you to leave the game/close it. But it shall only work by keyboard input. So I got the idea to create a widget which shows the text “press enter to leave” in the game screen and let it open up by pressing esc. Works fine so far. But now I need to tell the game that if I press enter now, it shall close the game. But the enter button only is supposed to close the game, if I pressed esc before and opened my warning/widget asking if I really want to leave.
So how do I tell the enter key to only close the game if I had pressed escape before?
I tried to do what you told me, but I just couldn’t get it to work. Propably my fault.
I worked in the level blueprint to get the warning opened if Esc is pressed. Therefore, I used this simple setup:
Now comes the hard part (or the part, that’s hard to ME). First of all, I don’t really know, where in this Node-hierachy I should add the “Set Focus” and the “Set Input Mode to UI Only”-node. I experimented with different setups using the Set Input Mode to UI Only-node, but could not achieve anything.
The “Set Focus”-node was very interesting. I couldn’t even really find it . As I said, probably I am doing something HORRIBLE easy HORRIBLE wrong, but I just don’t know what. I experimented with these two nodes, but did not get any further:
I think I understood step 3 and why to use such a setup. If the “Enter”-button could be connected to “Quit Game” in the widget itself, “enter” would just quit the game if I opened the widget by pressing Esc before, am I right?
But unfortunately, that doesn’t mean I could build it
I tried to go into my widget and create a “Tab”-node (which could not be found in the widgets graph search). Also, I couldn’t find an accurate alternative. I was hoping for a “KeyDown”-node, but this also lead to no results. This really makes me feel stupid.
I assume that all these problems just appear because I am to stupid to understand UE or your explanation. Maybe you are in front of your PC now thinking “What an idiot”, and in this case you even might be right (concerning UE)
But I ask you to give me a more detailled explanation and maybe show me where I and my thoughts went wrong.
Thanks a lot!