Тёмный
No video :(

Godot 4 Pause Menu Tutorial 

Gwizz
Подписаться 13 тыс.
Просмотров 33 тыс.
50% 1

Quick tutorial on how to make a pause menu in Godot 4!
Main Menu tutorial:
• Godot 4 Main Menu Begi...

Опубликовано:

 

23 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 97   
@Arukajoe
@Arukajoe 2 месяца назад
My buttons weren't working and it was because the PauseMenu node needed to be in a CanvasLayer. works perfectly now thanks!
@DavidRycan
@DavidRycan 2 месяца назад
Believe it or not, you just alleviated an hour of headaches with this one comment. For anyone else who needs clarification, the top-level node has to be a CanvasLayer, with the Control node as a parent of it. Not the other way around, like I managed to do.
@Gwizz1027
@Gwizz1027 2 месяца назад
Pinning
@Yaya-toure-A
@Yaya-toure-A 24 дня назад
@@DavidRycan bro i dont get it :(
@NatiiixLP
@NatiiixLP 6 дней назад
@@Yaya-toure-A Put static overlay UI Control nodes (PauseMenu node in this video) into a CanvasLayer parent, not as a child of the Camera2D. Or just change the type of the root node of your PauseMenu to CanvasLayer. That way, when you insert it into another scene (e.g., "main" in this video), it will render on top of everything else and disregard the camera's transformation.
@arthurarruda49
@arthurarruda49 8 месяцев назад
i recommend using "get_tree().paused = true or false" to pause the game, since using engine.scale = 0 still records inputs from your keyboard, so you can jump or shoot in the menu, and engine.scale = 0 bugged my rigidbody3d for some reason. try using this: func pause(state): if state: Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) menu.hide() get_tree().paused = false else: Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) get_tree().paused = true menu.show() but you have to allow your menu node to work when the game is paused, every node has a process tab on the inspector menu, change the process mode to "when paused"
@nerd_mor
@nerd_mor 8 месяцев назад
This is the correct answer.
@Pelipcahh
@Pelipcahh 8 месяцев назад
This helped out tons, thanks!!
@Atticore
@Atticore 7 месяцев назад
I was confused in your example for a sec why true and false were seemingly swapped around, before realizing they're not! Huge mistake on my part, but for anyone else who gets confused, like I did, in the original script in the video, the 1 and 0 are for the timescale, and the're more like if the game time is moving or not. So in the video, a timescale of 0 means the game isn't moving, whereas in this example, if the game is in a paused state, you'd say the paused state is true (which can also be represented as 1) in programming, typically 0 is false, and 1 is true. so in my mind, I was confused why the numbers got flipped. This was very unintuitive to me until I worked it out logically. so to recap, in the video, they're setting the time scale (essentially the speed the game is moving at) to on or off (moving or not moving; paused or unpaused) which is why it uses a timescale of 0 or 1 (off or on) in this example, you're using an inbuilt pause variable, so it seems flipped, but it's really not; the question is changing from "should the game be moving" to "should the game be paused", which sound the same, but would have flipped answers to mean the same thing. if the game is NOT moving, then it IS paused. sorry for rambling, just wanted to share in case anyone else was confused.
@chloe.v
@chloe.v 7 месяцев назад
thank you for the advice!! is there a way to make it so that you can still use the escape key to unpause, whilst still not being able to accept other keyboard inputs?
@Atticore
@Atticore 7 месяцев назад
​@@chloe.v took me a minute to figure this out too. You have to set the process for the pause menu to "always" (so it can still read inputs when the game is paused) and it can't have any parents upstream that conflict with that. so for example, if you put your pause menu as a child of the player, that wouldn't work, because you want the player to pause when the menu opens, and the pause menu won't work if it's a child of a pausable entitiy and also needs to be able to read inputs when paused. my solution is to either put the pause menu as a child of the level, have the (root) set to always in the process tab, and then have a child of the level that's called "pausable" that everything that should be able to be paused gets child-ed to. then I came up with a better solution: make a new parent for the player entity, and set the pause menu and player as children of it. then set that parent to always and the player process set to pausable. The biggest thing to remember is just that anything upstream of the pause menu in the parenting tree can't be pausable, or it'll break the pause menu's ability to unpause (seeing as it'll be paused and then can't take inputs 😵‍💫)
@notthat_funny
@notthat_funny 11 месяцев назад
THANK YOU SO MUCH! YOU HAVE NO IDEA HOW LONG I’VE BEEN WAITING FOR THIS VIDEO!
@vicmalicious
@vicmalicious 8 месяцев назад
Excellent tutorial. As someone who doesn't do any GUI or graphic implementations I was able to knock this out in minutes. Appreciated.
@yokubo1254
@yokubo1254 5 месяцев назад
For anyone using godot 4 you can only have ONE engine time scale program line throughout your entire world scene, spent a hour figuring this out....
@Betegfos
@Betegfos 11 месяцев назад
This is awesome! Subscribed. Could you please make an Options menu as well? Also would be nice to see how to switch scenes with a loading screen in a 3D game.
@Trendsthismonth
@Trendsthismonth 7 месяцев назад
I have tried this video twice now.... The pause button only works 1 time.
@theyellowarchitect4504
@theyellowarchitect4504 11 месяцев назад
That blur shader! Many thanks.
@Gwizz1027
@Gwizz1027 11 месяцев назад
Ya that one took me a bit, I had to find 2 shaders from both godot 4 and godot 3, then combine them together. Since, neither worked
@theyellowarchitect4504
@theyellowarchitect4504 11 месяцев назад
@@Gwizz1027 I feel you. At least no one else will have to go through those steps for such a basic shader :)
@Gwizz1027
@Gwizz1027 11 месяцев назад
@@theyellowarchitect4504 Ill have to find somewhere to post it
@DavidReidChannel
@DavidReidChannel 8 месяцев назад
Thanks for this my friend. This video saved me a ton of time. Thanks for sharing.
@caspervandenbussche4822
@caspervandenbussche4822 Месяц назад
Thanks for the amazing tutorial!
@julianvoinic07
@julianvoinic07 11 месяцев назад
Please make a tutorial on Player pushing and/or pulling blocks/obstacles 🙏🙏
@Gwizz1027
@Gwizz1027 11 месяцев назад
oooo I like this one
@ryancurtis5425
@ryancurtis5425 9 месяцев назад
Thank you for this! I had to do some tweaking to make it work for my game, but very simple and easy to follow!
@duccloud4101989
@duccloud4101989 6 месяцев назад
You saved my day. Thank you :)
@CasticDigital
@CasticDigital 2 месяца назад
This shows exactly what I needed (even the blur, funny enough) but I was hoping you would explain what it was you were actually doing. I understand godot very minorly but enough to understand everything up until the blur portion of the video. All that code you wrote to implement the blur went right over my head. Wish it was explained :/
@adiveler
@adiveler 10 месяцев назад
Wouldn't it be more practical to use CanvasLayer node instead of Camera2D?
@OnBrandRP
@OnBrandRP 9 месяцев назад
By a long shot! Scales better!
@EverythingCoding29
@EverythingCoding29 4 месяца назад
hey, nice tutorial! one question though, if you are making this with a 3d level sceen would it still work?
@dahvini7339
@dahvini7339 Месяц назад
is there a better way to do resume than ../../../../../ for how ever many nodes you have because I keep getting null pointers
@Yolwoocle
@Yolwoocle 8 дней назад
You can obtain the root node using get_node("/root/NameOfYourRootNode")
@NatiiixLP
@NatiiixLP 6 дней назад
Yes, there are a few options: - Use @export annotation instead, and drag'n'drop the relevant node into it. - Use an absolute path instead (e.g. $"/root/MyMainScene/MyPauseMenu"). - Use a global event bus, i.e. a signal in an autoload script, which will be emitted when you click the button from wherever your code handles input, and connected to a function that toggles the pause menu's visiblity.
@KHJohan
@KHJohan 11 месяцев назад
clear and to the point :D
@triingalxy135
@triingalxy135 6 месяцев назад
i have a issue; when i pause i cant unpuase!
@AvitheTiger
@AvitheTiger 21 час назад
YOU CAN USE TEXTURELOD TO BLUR THINGS WTF?!
@Genko618
@Genko618 8 месяцев назад
hello. I followed your instructions, and it did help me. however, there's a problem that I encountered when I tried to open the pause menu; the buttons shows behind the player. I also tried putting it at the very bottom and at the very top of the layer but nothing happens. can you help me?
@guy9651
@guy9651 5 месяцев назад
On your pause menu node, go to Inspector > Ordering > and change the Z Index to a number higher than the Ordering on your player node. Consider this as a Z axis where anything > 0 is approaching you and anything < 0 is going further away from you
@victorgustavo4366
@victorgustavo4366 Месяц назад
When I pause the game, the character3D stopped, but he continues doing moviments into the game. How fix it?
@Gwizz1027
@Gwizz1027 Месяц назад
stop taking movements from the controller
@victorgustavo4366
@victorgustavo4366 Месяц назад
@@Gwizz1027 Seriously? I would hope the char stopped as well...
@creatingwithac
@creatingwithac 2 месяца назад
My menu works but when I press the resume button it unpauses everything but doesn’t disappear. Any tips on how to fix that?
@Gwizz1027
@Gwizz1027 2 месяца назад
Hide the menu
@questforsteve
@questforsteve 2 месяца назад
Try self.visible = true when pausing and self.visible = false when unpausing
@Gwizz1027
@Gwizz1027 2 месяца назад
You dont need to reference self in a node, if it is the self, it's kind of redundant. You can also use hide and show.
@questforsteve
@questforsteve 2 месяца назад
It didn't like me just using show()/hide() or getting rid of self (it said those functions/identifiers weren't declared in the current scope). Maybe it's because the root of my pause menu is a canvas layer instead of a node? Or might be because I made my pause_menu.tscn an autoload so I don't have to put in in every scene? Don't know lol, but self.visible seems to work for me
@questforsteve
@questforsteve 2 месяца назад
Found my issue lol, when I changed the root to a canvas layer I had forgotten to also change extends Node to extends CanvasLayer, so now show()/hide() work as expected
@pankelee2634
@pankelee2634 8 месяцев назад
Thank u so much man
@MoreEspresso1
@MoreEspresso1 Месяц назад
My menu worked and ive tried what seems like everything to fix it. I have all of the same code but it wont show up on my 3D game. Can you help?
@Aes_Saru
@Aes_Saru Месяц назад
hey for the opposite paused. What character is that? Like anything I put on there just causes errors.
@stephentatemcinematography2226
@stephentatemcinematography2226 Месяц назад
its an exclamation point i believe
@OugonGatekeeper
@OugonGatekeeper 7 месяцев назад
Thank you!
@Wilker_uwu
@Wilker_uwu 8 месяцев назад
what are my options for using functions such as `_unhandled_input(event)` to handle all of this? will that get affected by time scale? or similar things?
@nickbarbosa2004
@nickbarbosa2004 11 месяцев назад
I did every step, but my pause menu won't unpause when I press Escape twice
@flarglfump9915
@flarglfump9915 8 месяцев назад
Make sure input checking for your “pause” key input is still happening when the “paused” state is active in your game
@Claudehopper
@Claudehopper 8 месяцев назад
I'm having the same problem
@cryptologan
@cryptologan 7 месяцев назад
The pause menu only works one time per game.
@annabelleowl9586
@annabelleowl9586 3 месяца назад
It doesn't quite work for me, my pause menu wont hide and it doesn't stop the game. anyone got tip?
@irissteroe7966
@irissteroe7966 4 месяца назад
I've enabled viewport following and the pause menu is now a child of the camera node, but *still doesn't follow the player view.* Is there something I'm just not checking?
@Gwizz1027
@Gwizz1027 4 месяца назад
You probably aren't using the canvas layer
@StarlightDX
@StarlightDX 10 месяцев назад
the shader doesn't seem to blur everything but if I move slightly it blurs what was not blured and vice versa
@sibstitcher
@sibstitcher 9 месяцев назад
I had the same issue when my background was not evenly filled (ie the background had empty spaces between the texture I wanted to blur). Putting another ColorRect behind with full black solved.. hope that helps you too!
@beytullahberk3632
@beytullahberk3632 9 месяцев назад
Game crashes whenever i try to pause, why do you think that would be? only difference is that my Camera2D is a child of Player
@slip_to_thesilent
@slip_to_thesilent 4 месяца назад
damn have a issue that in my menu works but blur effect does not appear , even so i checked other tutorials and they have everything the same. What i should do? Where in tree i should put pause menu on level or on camera of my character?
@Computer-instructor
@Computer-instructor 4 месяца назад
In the material section of the color rect you have added shader there should be an option called shader parameters click on it and set value of 3 if you have missed it if this didn't help maybe redo the tutorial, my problem was same 😊😊😊😊
@DEADEYESTUDIO
@DEADEYESTUDIO 10 месяцев назад
does the pause script have to be in the root node? mainly wondering cuz i do wanna disable the pause function if my player is reading a news article in game [and since escape is used to exit article i dont want it to bring up the pause function]
@Gwizz1027
@Gwizz1027 10 месяцев назад
Nope! It can be anywhere
@DEADEYESTUDIO
@DEADEYESTUDIO 10 месяцев назад
@@Gwizz1027 oh good! thanks for replying
@lilcripsythereal
@lilcripsythereal 10 месяцев назад
Hey, im doing this in 3d and i want to make it so my mouse cursor will show since my game is a fps game
@npcfrfr174
@npcfrfr174 10 месяцев назад
Are you using Input.MOUSE_MODE_CAPTURED? If yes, here's what a did: In process Delta when you press pause button you set mouse mode to visible Down in the Delta func u write If not paused Paused = false. It works but quite weird.
@lucas_pscheidt
@lucas_pscheidt 5 месяцев назад
how did you drag the node and automatically created an onready var?
@Gwizz1027
@Gwizz1027 5 месяцев назад
Hold ctrl + drag
@thesomeone2nd
@thesomeone2nd 10 месяцев назад
Hey man I want to ask if we have a player in the main scene and a camera following him how can we add the pause menu to open in the player camera?
@Gwizz1027
@Gwizz1027 9 месяцев назад
Ya that shouldn't be a problem
@thesomeone2nd
@thesomeone2nd 9 месяцев назад
@@Gwizz1027 I am adding it to the camera but it doesn't work it shows it at the start X and Y axis
@OnBrandRP
@OnBrandRP 9 месяцев назад
@@thesomeone2nd do a CanvasLayer instead and lock it to the screen boundary you want, so if it's in the center screen, lock it to that and boom.
@thesomeone2nd
@thesomeone2nd 9 месяцев назад
@@OnBrandRP what is screen boundary and how do you lock it there
@opensky0
@opensky0 11 месяцев назад
Why are you making it the opposite with the paused variable
@Gwizz1027
@Gwizz1027 11 месяцев назад
since, the opposite of true is false, and the opposite of false is true, so I can toggle the "paused" variable in 1 neat line
@Snikur
@Snikur 11 месяцев назад
@@Gwizz1027 I might be wrong, but I think he talked about the fact that if paused == true, the game is not paused? Since time_scale is 1 if paused.
@Gwizz1027
@Gwizz1027 11 месяцев назад
@@Snikur its reverse since we are setting the paused variable after
@Gwizz1027
@Gwizz1027 11 месяцев назад
I suppose I could've put it before hand, then it would be more intuitive.
@OnBrandRP
@OnBrandRP 9 месяцев назад
@@Snikur Paused is set to False, so when the function tries to call "paused:" it's reading the variable as false and thus it is hiding the pause menu.
@yoopyoop331
@yoopyoop331 6 месяцев назад
i love you
@Gwizz1027
@Gwizz1027 6 месяцев назад
And I love you random citizen!
@100Jim
@100Jim 7 месяцев назад
SUBBED AND LIKED! I have been struggling to get my pause menu working in my platform game for 2 days but I got it working thanks to you and some code and node restructuring. I also got your shader working but had to save it as a scene, make it hidden and show it when paused and hide it when un-paused. I also corrected your code for pausing. You have to also make process mode in the Inspector 'pausable' on any any node you want to pause and change it to 'when paused' on the pause menu node. See my code below: @onready var bg_blur = %"Shader bg blur" @onready var pause_menu = %"Pause Menu" var paused = true func _ready(): pass # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): if Input.is_action_just_pressed("menu"): #You might have called menu something else. #Change #it. pauseMenu() func pauseMenu(): if paused: print ("Paused", paused) Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) pause_menu.show() bg_blur.show() get_tree().paused = true else: print ("UN-Paused" , paused) Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN) pause_menu.hide() bg_blur.hide() get_tree().paused = false paused = !paused Loving this coding me like. Might do a dev blog on YT
@LiveGameDriveChannel
@LiveGameDriveChannel 8 месяцев назад
why not get_tree().paused = true?
@frazomania
@frazomania 8 месяцев назад
why not do that lol
Далее
Godot 4 World Environment Tutorial
3:01
Просмотров 9 тыс.
Godot 4.3 is Here!
19:20
Просмотров 83 тыс.
Easy way to make a scaling UI menu in Godot 4.2
11:23
Просмотров 1,6 тыс.
Background Loading & Loading Screens | Godot 4
2:53
Просмотров 21 тыс.
4 Godot 4 Devs Make 4 Games in 44 Hours
25:19
Просмотров 510 тыс.
How To PLAN your Game as a Solo Developer
16:26
Просмотров 488 тыс.
Godot UI & Control Node Crash Course
20:11
Просмотров 4,4 тыс.
A new way to generate worlds (stitched WFC)
10:51
Просмотров 525 тыс.
Using AI to Create the Perfect Keyboard
12:05
Просмотров 1,4 млн
How Games Make VFX (Demonstrated in Godot 4)
5:46
Просмотров 336 тыс.