x

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"

Pause / Un-Pause with same key not working

Hello Unreal community!

I'm having an issue that I've been racking my brain on for a bit now and I figured before I head to bed I'd ask for a new set of eyes. Basically the issue is the game pauses and the menu comes up as normal. Using the resume button works as well as the quit button. What I'm wanting to do is add the functionality of being able to unpause the game with the same key using the "FlipFlop" node.

I was almost 100% certain this would work but it's not working as intended. I know it's partially working because if I use the "Resume Game" button then hit pause again the cursor disappears as it should.

Can anyone possibly give me some input on why this might not be working as expected?

alt text

Product Version: UE 4.17
Tags:
more ▼

asked Oct 17 '17 at 02:48 AM in Blueprint Scripting

avatar image

xCasino
6 1 2 2

(comments are locked)
10|2000 characters needed characters left

3 answers: sort voted first

I know I'm late to the party and this may be an obvious suggestion, but did you try setting the 'execute when paused' option on the pause input node?

more ▼

answered Feb 21 '18 at 12:59 AM

avatar image

Trueform
51 3 2

avatar image Crazy Rabbits Mar 08 '19 at 04:31 AM

This is the correct answer, thank you

(comments are locked)
10|2000 characters needed characters left

Try having a variable that changes between true and false when the player pauses/unpauses the game. For example, have a boolean variable that changes to true when the esc key is hit for the first time then will change to false when the player clicks the resume button AND/OR when the player hits esc the second time. Instead of having a flipflop, have a branch that checks the variable. If the player hits esc, have it check to see if it's true or false. If its true, execute the code to unpause the game, then change it to false. If it's false, execute the code to pause the game then change to true. Make sure that the variable changes to false when the resume button is clicked too.

Try that and let me know if you are still experiencing problems!

more ▼

answered Oct 17 '17 at 08:38 PM

avatar image

GamerRiotz
40 4 9 15

avatar image xCasino Oct 18 '17 at 02:07 AM

I tried this method and got the same result.

(comments are locked)
10|2000 characters needed characters left

I think BP_Character doesn't receive input when you use Set Input Mode UI Only. Does the event on BP_Character even fire once the game is paused?

You probably need to grab the key input in your menu and close it and unpause from there.

more ▼

answered Oct 18 '17 at 12:56 AM

avatar image

Ecnassianer
151 4 9 11

avatar image xCasino Oct 18 '17 at 02:09 AM

I've followed this path and was able to find some more information on how to override the input in the widget blueprint BUT in all the other examples the GetKey Function has an execute pin and mine does not and cannot figure out why.alt text

avatar image Ecnassianer Oct 18 '17 at 02:56 AM

Some nodes have both a "pure" and .... well, I don't know what the other kind are called, I'll call it impure, but I think I made that up. Casts work the same way. The only difference is the ones with the execution pin (the impure ones) allow you to control what happens based on whether or not it failed. With a pure node, it just gets evaluated when it's needed, in your case when the Branch gets to execution. This means that if it fails, you just access none, and you can't do anything about it, since you can't redirect execution based on it failing. In your case, this is perfectly fine, because the On Key Down function should never fire with an invalid In Key Event.

avatar image xCasino Oct 18 '17 at 02:25 AM

If I remove the Set Input Modes entirely I get the desired result but then can no longer use the mouse to interact with the menu.

avatar image Ecnassianer Oct 18 '17 at 02:57 AM

What happens when you add the Escape key event (the same one you're using in BP_Character) in your widget? Does it not fire?

avatar image xCasino Oct 18 '17 at 03:10 AM

You can't add it directly without overriding the "OnKeyDown" function in the Widget Blueprint which is the graph you see above. The attached image is from another person with a similar issue and apparently achieved the desired results.

alt text

76342-2.jpg (109.3 kB)
avatar image Ecnassianer Oct 18 '17 at 03:31 AM

Aha, I understand now. Out of curiosity, what's the thread you found that on? I'm planning to do something similar on my own project soon and would like to read it.

When you set your blueprints up the way that image shows, does On Key Down ever fire? What's the NOTE on the branch?

Now I see what you mean about Get Key being different in yours than in the screenshot. Did you drag Get Key off the In Key Event Pin, or add it by right clicking? Try dragging the pin off if you didn't.

(comments are locked)
10|2000 characters needed characters left
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