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"

Open/Close a Menu with the same key

Hey, I have a problem with closing a widget (Pause Menu) with the same key i opened it. I wanted to make 2 Options to close it: First one is the Resume Button which is working great and then theres pressing the same key again and this is not working :/

ResumeButton: ResumeButton

Open/Close Blueprint: Open Close Menu

Product Version: UE 4.19
Tags:
more ▼

asked Apr 28 '18 at 11:02 PM in Blueprint Scripting

avatar image

Fvnex
1 1 2 6

avatar image ThompsonN13 Apr 29 '18 at 12:19 AM

Does it do anything when the button is pressed? It may be as simple as selecting the input action event you have and going to the datils panel to enable it to work when game is paused (i dont remember the exact wording but it will be something like execute on paused. It should be near the top)

avatar image Fvnex Apr 29 '18 at 12:22 AM

Hasnt change anything :/

avatar image Fvnex Apr 29 '18 at 12:23 AM

And no it doesnt go to the True Part of the Branch no matter what i press.

avatar image Joanis Apr 29 '18 at 01:09 PM

Did you fix it? or still searching for a solution?

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

4 answers: sort voted first

If you want to Open and Close a widget using the same button, all you need to do is just put a Flip Flop, atleast that's how i do it.

more ▼

answered Apr 29 '18 at 01:14 PM

avatar image

Joanis
11 1 2

avatar image Wombley123 Apr 29 '18 at 01:19 PM

Correct, once pressed = open the widget, press it again = close it..and so on.

avatar image Norishou Apr 29 '18 at 01:33 PM

But if you close it with a button in a widget the flipflop tries to close it again when you press it.

avatar image Joanis Apr 29 '18 at 01:39 PM

What you want is when you click a button some widget to popup, and when you press it again to close and go so on? Right?

avatar image Norishou Apr 29 '18 at 02:05 PM

Bit wants also a Button in the Widget to close it

avatar image Joanis Apr 29 '18 at 02:13 PM

He already has one?

avatar image Norishou Apr 29 '18 at 02:22 PM

Yes Look at the Pictures at the top.

avatar image Joanis Apr 29 '18 at 02:37 PM

But it works, doesen't it?

avatar image Norishou Apr 29 '18 at 02:53 PM

This works but the key event doesnt work because he probably didnt check the box or did change the Input Mode

avatar image Fvnex May 04 '18 at 08:09 AM

Yes I can open it with my Pause Button (Esc) and I can close it with the Resume Button, but I want it to close with The Esc Button again too.

avatar image Joanis Apr 29 '18 at 01:44 PM

Create 2 branches

avatar image Joanis Apr 29 '18 at 01:47 PM

Start like this. Fvnex

screenshot-1.png (55.3 kB)
avatar image Fvnex May 04 '18 at 08:08 AM

Well there are still problems: 1. With a FlipFlop you have to press The button 2 times after you close it (with my current Resume Button) 2. Its still not working

But thanks for your help, I didnt noticed that someone answered this post so Im a little bit late :D

avatar image Fvnex May 04 '18 at 08:11 AM

Heres the current Blueprint: (I didnt change the Resume Button) Blueprint

screenshot-2.png (293.8 kB)
avatar image Fvnex May 04 '18 at 08:14 AM

I actually have the suspicion that I cant press any keys when its in UI Mode. So that the Inputs are "closed" when the UI mode is activated. And only when I remove the UI mode with the Resume Button, I can press it/open it again.

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

It is because if you have a blueprint this gets paused and if you press the key it doesnt do anything because it is paused.

more ▼

answered Apr 29 '18 at 07:44 AM

avatar image

Norishou
21 1 5

avatar image Fvnex Apr 29 '18 at 10:31 AM

And how can i unpause it?

avatar image Norishou Apr 29 '18 at 11:47 AM

Only if you press on the key event and check the box execute when paused. The Input Mode needs to be Ui and Game

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

You have to set the game mode to "Game And UI" not just "UI Only" as UI Only will not allow keyboard input. Hope that helps :)

more ▼

answered May 04 '18 at 01:07 PM

avatar image

Kit Kat134
203 1 9 10

avatar image Fvnex May 04 '18 at 05:06 PM

Hes but then my character is still able to move during the Pause Menu is opened. Is there any other node where i can stop the game but still keep the input?

avatar image Kit Kat134 May 05 '18 at 06:24 AM

Create a bool "Paused" set it to true when the game is paused. In the movement code, before "Add Movement Input" put a branch that checks whether the game is paused. If it is not paused add the movement input.

I've done this before so i know it works. If you still have trouble post another comment :)

avatar image Kit Kat134 May 05 '18 at 06:26 AM

Here's a screenshot belowalt text

Hope this clears up any confusion :)

capture.jpg (39.1 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

This should work, you just need to pay attention that you need to use game and ui input mode, otherwise if its just UI, your inputs(key bindings) wont be registered. alt text

alt text

P.S. forgot to add a node for pausing the game, hopefully you can figure out where it needs to be

test4.png (173.7 kB)
test5.png (9.6 kB)
more ▼

answered May 04 '18 at 06:33 PM

avatar image

Fruti
1 1 2

avatar image Fvnex May 04 '18 at 07:58 PM

Thank you so much, everything working great. Only thing/problem is that I need to press Esc twice to open the menu after I hit the Resume Button, when I use Esc to open and Esc to close everything works fine.

avatar image Fruti May 04 '18 at 11:45 PM

So when you press resume you can add another event to where escape input is. So you would only use the same code for opening/closing. To put it simply on resume button clicked cast to the blueprint where your opening logic is and from there get your custom event.

(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