Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Play event after key sequence

Hi everyone,

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?

Thanks a lot!

Product Version: UE 4.8
more ▼

asked Aug 27 '15 at 01:13 PM in Blueprint Scripting

avatar image

6 1 4 7

avatar image Devero Aug 27 '15 at 01:18 PM

A little confusing on the setup, but If i understood:

You want to hit "Esc" to bring a message box "Really want to Leave?" and then on there you want to check for pressing Enter to exit?

avatar image 3Dler Aug 27 '15 at 01:23 PM

Exactly. Sorry for the bad explanation. It has been a long day :-D

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Then I would do the following setup for as an example,

1) Setup and Input Key for your PlayerController blueprint for the "Escape" key.

2) When the Escape Key is pressed, turn on your warning/confirmation button, make sure to "SetFocus" to the widget, and Set Input Mode to UI Only.

3) In your widget, check for the KeyDown event for the "Enter" key.

From there exit the game.

UMG and button mapping is still something the devs want to improve on but for now thats a way to do it. Hope that helps =)

more ▼

answered Aug 27 '15 at 01:59 PM

avatar image

2.3k 114 62 235

avatar image 3Dler Sep 03 '15 at 01:26 PM

Hey there, the Noob is back ;-)

First of all, thank you for your answer!

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:

alt text

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.

alt text The "Set Focus"-node was very interesting. I couldn't even really find it :-D . 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:

alt text 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 :-D 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!

screen01.png (229.7 kB)
screen05.png (260.7 kB)
screen02.png (184.7 kB)
screen03.png (192.5 kB)
screen04.png (156.7 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question