Hello,
I have made a pause menu and i am trying to toggle it using a key. How can i go about doing this? This is what i have so far. Basically, i want to just turn it on and off by hitting a key.
Hello,
I have made a pause menu and i am trying to toggle it using a key. How can i go about doing this? This is what i have so far. Basically, i want to just turn it on and off by hitting a key.
By setting your game to input mode only, you are disabling the pause menu bind.
Try removing that part and it will work.
I have removed this but its still not working for some reason. When i click escape it comes up but when i click it again it doesn’t close.
You are using set game pause to pause the game, so probably the character input bindings wont work when the game is paused, you need to do something else. For Example, You can add Escape binding inside the widget to execute this code.
Can you send me a picture of this? I don’t believe i am doing this right. Just want to see what i am doing wrong.
Can you show me a picture of this?
this is how I do it https://i.imgur.com/BTgECQP.png, this should be done in the Player Controller you are using, not in the actor that you are possessing
Sorry, i was out of station and could not reply. You just right click on the widget blueprint, and then under input-> choose your key i e ESC and then put you function there.
If I remember right, when I was doing it this way If I kept the esc key down it was switching the widget ON/OFF so I had to do this, you can either use the listen for input action node. the time variable is set to 0, I get it and add it to the delta time and when it reach .5 it allow to remove the widget.
You dont have to worry the ESC key toggling when you dont want, cause OP creates the widget dynamically and since the widget is not actually existing during normal gametime, pressing ESC should only execute the function under the player characters InputBind.
Ok cool, so I didn’t use this method, much easier than mine then
When I try to add the pause menu under the target for the function “is in viewport” I cant find my pause menu widget. Would you know why that would be?
I don’t know, I’ve just tried, i can drag it from the widget reference or even from the create widget node directly.
If this is from your pause widget you don’t need, the self pin reference to itself
Yeah, looks like my reference is messing me up. When i try to create a reference to the widget, no widgets are available.
Yes, you have to right clic on the blue pin return value of the node create widget and promote to a variable, and this is the widget reference you’ll use
All variables you need to create to reference an object, you have to get the reference from a cast. In this case eitheir than the get all actors of class node, it works like a cast
I almost have it! Getting excited! So when i press the escape key, i see it goes to false as it should then it tries to add it to the view port. From there, it doesn’t do anything for some reason even though i have it set.
You should do as I do in the preview pics. Create the widget in the player controller or character, create a variable add to viewport. Then from your widget set the remove from parents. You don t need the is in viewport because it won t call the input from the chara bp because the game is paused so input are disabled
How did you do your character reference at the end of the widget blueprint?
At event begin construct or event begin to play for other BP, you can cast to the actors you’ll need references, mostly your character, so you cast to and then promote to a variable by right clicking the blue output pin, then you can use this ref to call any variable in this blueprint.