Tutorial: Pause Menu in Godot 4

  Рет қаралды 23,067

Bramwell

Bramwell

Күн бұрын

Пікірлер: 121
@jackkinsey
@jackkinsey Жыл бұрын
With 4.0 stable out, for anyone following along with this tutorial: the minimum size for the Panel Container is no longer under Rect, but is instead under Layout -> Custom Minimum Size.
@frozenfridge3943
@frozenfridge3943 Жыл бұрын
Gigachad
@idlekrisp
@idlekrisp Жыл бұрын
the developer we need, but the developer we dont deserve
@herrychuzz6393
@herrychuzz6393 Жыл бұрын
4:33 Size Flags are under Control > Layout > Container Sizing 11:30 find_node is find_child now The -> arrow is typed just like that. Thanks for the tutorial! Works great in my project.
@fansot0592
@fansot0592 Жыл бұрын
bro you saved me
@N0THANKY0U
@N0THANKY0U Жыл бұрын
This might be the best godot tutorial on youtube, you explained everything so clearly and concisely. subbed!
@Tehcn_
@Tehcn_ 2 жыл бұрын
Quick note for anyone adding this to a pre-existing project: if you use _unhandled_input to control your character/player, your mouse inputs might be blocked. Just use _input instead. PS: I'm new to Godot in general, so if there might be a trade-off I don't know about, but this worked for me.
@FlasherOfThunder
@FlasherOfThunder 2 жыл бұрын
Worked for me so far, thanks for the tip.
@DonLeeelbow667
@DonLeeelbow667 Жыл бұрын
Thanks, I just complained about that before seeing this tip.
@pespsisipper
@pespsisipper Жыл бұрын
thx it worked!
@thomasrosebrough9062
@thomasrosebrough9062 3 ай бұрын
Fantastic tutorial. No fluff, great tips for the task at hand as well as keeping an eye on best practices which noobs like me appreciate so so much! Can't thank you enough!
@shomeyotubbs
@shomeyotubbs Жыл бұрын
Just felt the need to comment and say that this is a wonderful tutorial. I've used to create multiple UI pieces for my game, not just the pause menu. Your use of nesting containers to help keep the UI elements fitted to the screen is brilliant and missing from other tutorials I've seen. Great work!
@adamgrace726
@adamgrace726 Жыл бұрын
To anyone viewing this as of March 10 2023 you will receive an error whilst trying to use SCREEN_TEXTURE. "SCREEN_TEXTURE has been removed in favor of using hint_screen_texture with a uniform. To continue with minimal code changes add 'uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;' near the top of your shader."
@FourGamesDev
@FourGamesDev Жыл бұрын
@cuppixd4267
@cuppixd4267 Жыл бұрын
Saved me, thx
@mys3544
@mys3544 Жыл бұрын
MVP
@MistaSmith
@MistaSmith Жыл бұрын
6:33 SCREEN_TEXTURE got removed in favor of sth else (I don't get it), but can be added again like this: `uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;`
@NotSuperSerious
@NotSuperSerious Жыл бұрын
4:13 you can change the font size from the inspector, under "Theme Overrides", in case you don't want to change resolutions ... and yes, apparently this bug is still a thing in 4.0.1, unless i'm missing something (very possible)
@KingBlueHippo31
@KingBlueHippo31 2 ай бұрын
Thanks , this helped a lot because it wouldn't appear for me. I was about to look for a tutorial for a tutorial!
@stucktj
@stucktj Жыл бұрын
This was a very helpful tutorial. In addition to a pause menu, I was able to get a working death and restart menu working from the same concepts shown in this tutorial.
@kulak8548
@kulak8548 2 жыл бұрын
15:22 Is there really any need to ignore the check for the escape key when pause mode is true? I just put this into the pause menu script and it works fine: func _unhandled_input(event: InputEvent) -> void: if event.is_action_pressed("pause"): if get_tree().paused: resume() else: pause()
@ortusleo7367
@ortusleo7367 Жыл бұрын
Thank you so much for this tutorial! I just started learning Godot a couple of days ago and I'm finding the lack of assets really difficult to deal with in comparison to something like Unity. This was so helpful and super quick to implement!
@CarbsCode
@CarbsCode 2 жыл бұрын
Lots of little great things in Godot 4 it seems! Love these videos man learn so much in such all at once 😀
@BramwellWilliams
@BramwellWilliams 2 жыл бұрын
Always lovely to hear from you Carbs! Definitely and glad you liked it c:
@lucsteffens
@lucsteffens 2 жыл бұрын
Love the escape also "triggered" the button animation in the end!
@skulltrick
@skulltrick 2 жыл бұрын
This was incredibly helpful! Thank you so much for making this
@rafeu2288
@rafeu2288 2 жыл бұрын
10:55 You could use `:=` to infer the Node type since it is known at "compile-time". It allows to remove duplication of type-hints for either the declarative stuff like the node types, but also works when you initialise from a typed function: For example, if I have this function: ``` func give_me_the_answer() -> int: return 42 ``` Then I can infer the type, so instead of : ` var my_answer: int = give_me_the_answer() ` I can just write, for the exact same benefits: ` var my_answer := give_me_the_answer()` Hope this is useful for the someone. If you want to search for it, it is called "Type Inference" godot. Have a great day :D
@AndyAndrewEntertaiment
@AndyAndrewEntertaiment Жыл бұрын
For anyone not finding the "Size Flags -> Expand" they moved it under "Layout -> Container sizeing -> Expand"
@TheoKregaard
@TheoKregaard Жыл бұрын
Thanks a lot! :D
@wolcamophone4783
@wolcamophone4783 2 жыл бұрын
find_node("whatever") doesn't seem to want to work in alpha 11, returns "Function "find_node()" not found in base self." You can right click and copy the path to the node manually to paste into the string for get_node("marg/box/whatever") which documentation says is faster anyway.
@medhatriad
@medhatriad 2 жыл бұрын
use find_child("whatever") instead
@wolcamophone4783
@wolcamophone4783 2 жыл бұрын
@@medhatriad Thank you!
@mariusbaumann2480
@mariusbaumann2480 2 жыл бұрын
great content man! Thanks for doing this stuff, also since shaders are still a form of blackmagic to me I really appreciate the simple explenations for them
@firezacerick
@firezacerick Жыл бұрын
For some reason, when I made the start menu it is pausing also the buttons, even with the mode seted to aways. Can anyone help me?
@deathfxu
@deathfxu Жыл бұрын
I am having this same issue! My buttons seem paused. They aren't getting mouse hover or click events. I have been trying to solve this problem for several days. Please help!
@deathfxu
@deathfxu Жыл бұрын
I figured it out. Make sure that your buttons are on a CanvasLayer
@jaypalmer0616
@jaypalmer0616 9 ай бұрын
I'm so close to getting this working, I used your fps controller tutorial and slapped the two together, but the issue is that the mouse no longer controls the camera and i don't know why
@H0lley
@H0lley 2 жыл бұрын
note that the blur background effect can also be achieved without a shader, simply by setting dof_blur_near_enabled of Environment (or CameraEffects in Godot 4). unfortunately though, canvas environment/camera effects do not work at all in the current Godot 4 alpha.
@BramwellWilliams
@BramwellWilliams 2 жыл бұрын
Good point! Yeah that's a really sad problem - I just want to add glow in 2D! :')
@MixedSourceStudio
@MixedSourceStudio 5 ай бұрын
at 7:20 when i set my brightness to 1 the background is all White.... what am i doing wrong?
@MixedSourceStudio
@MixedSourceStudio 5 ай бұрын
I fixed it needed to add uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap; But had added: uniform sampler2D SCREEN_TEXTURE ;
@Crompwell
@Crompwell Жыл бұрын
Any chance we could get a short tutorial on how to get this menu working with gamepad inputs? Pretty please?
@wukerplank
@wukerplank 2 жыл бұрын
I'm trying to use this in a project where the mouse is captured and now my mouse movents get swallowed... How do I get around this?
@ThaAftrPartie
@ThaAftrPartie 7 ай бұрын
I know I’m late, but In the func, change “CAPTURED”: in “MOUSE_MODE_CAPTURED” To “VISIBLE” If you don’t want it consumed by the client.
@comradecid
@comradecid Жыл бұрын
fyi - i ran into an issue whilst attempting to 'adjust' the unpause animation; i wanted the menu to fade-out more gracefully, and so disabled its autoplay-on-load setting, instead triggering the unpause only when the player exited the menu. i soon discovered that regardless of the settings/overrides i attempted to apply to the menu, it was always visible by default. the animations continued to work correctly (it would fade in and out as expected), but try as i might, i couldn't get the bloody thing to be hidden by default. only then did i finally realise that it required the use of a default animation state; b y duplicating my existing unpause animation, i created a third animation called 'hidden', which executed a hide in the shortest possible timeframe. i then set this to autoplay-on-load, and continued to apply my slower unpause animation programmatically when the user triggered ui_cancel. after a fair amount of cursing, it worked like a charm.
@WatchNev
@WatchNev 7 ай бұрын
I struggled for like 4 hours trying to get my game to `unpause` with a key press and not have to add a button. Finally caved in to look at videos and this made it look extremely easy. With help from all the comments below as well for updated changes.
@triingalxy135
@triingalxy135 11 ай бұрын
it says"expetced data type fo this code:uniform blur: hint_range(0.0, 1.0); how do i fix?
@rje613
@rje613 Жыл бұрын
This doesn't work in Godot anymore, even with the fix for SCREEN_TEXTURE. For some reason the blur doesn't affect 3D scenes. Anyone else had the same experience?
@kpickett9128
@kpickett9128 Жыл бұрын
for me the blur was there but it was very subtle for some reason, so i ended up cranking up the blur slider max value in the shader to .75 to make it more obvious... but i'm in a 2D scene, using Godot 4.1.3, so might be unrelated to the issue you're seeing if that issue is unique to 3D scenes or a different version : (
@rje613
@rje613 Жыл бұрын
@@kpickett9128 I think I ended up finding a fix for it. The first issue was that there has to be objects beyond the scene. As in, if you literally just have a cube in a blank scene, even with a light and an environment, it wouldn't work because it couldn't blur the edges of the cube "into" anything, so to speak. Also, objects that clip into the sky wouldn't blue. Very odd! The second issue was related to SSR (screen-space reflections). For some reason, having that enabled in scene world settings caused weird artifacts, and also prevented the blur from working entirely. In the end, I settled for using a gausian filter instead. The built-in textureLOD function was just way too temperamental and I wanted something more permanent and less fiddly.
@wolcamophone4783
@wolcamophone4783 2 жыл бұрын
I've decided I don't wanna use the animation, so I usually just toggle the whole node visibility in code, but self.visible(true/false) and self.show/self.hide don't seem to work anymore, at least not for the Control node
@wolcamophone4783
@wolcamophone4783 2 жыл бұрын
WAIT, NVM! It's self.visible = true/false
@Betegfos
@Betegfos Жыл бұрын
I receive the following error in the _ready function in Beta 10: Invalid type in function 'connect' in base 'Signal'. Cannot convert argument 1 from Nil to Callable.
@goranovs
@goranovs Жыл бұрын
Just wondering why all the demos are lagging on my Rog Laptop :/
@wellhellotherekyle
@wellhellotherekyle 2 жыл бұрын
The menu seems to work properly but when I added it to my FPS controller from your other tutorial now I can't turn around (though my movement keys still work). Any idea what's going on? PS.... Am I missing something or is the handy font size feature at the top gone now?
@alvhawk4461
@alvhawk4461 2 жыл бұрын
the font size feature at the top is gone but for label i found a label settings thing under where u put text and if u add it in u can change line spacing, font size, font color, outline, and shadow buttons is in theme overrides i think idk how to fix ur turning around issue tho sry
@gazz1617
@gazz1617 Жыл бұрын
@@alvhawk4461 Thank you! I was really scratching my head with where the font sizes moved to, LabelSettings look really nice
@terrytech8812
@terrytech8812 Жыл бұрын
This videos shader was not working for me and after some Chat GPT i got this masterpeace, Be sure to change the shadder parameters to around 0.002 shader_type canvas_item; uniform sampler2D screen_texture : hint_screen_texture; uniform vec2 blur_size; void fragment() { vec4 color = vec4(0.0); int count = 0; for(int i=-2; i
@_Micad
@_Micad 8 ай бұрын
what about the brigntess slider
@medhatriad
@medhatriad 2 жыл бұрын
Thank you for this great tutorial. One tip: for the last part (getting out of the pause menu), you can simply add a togglePause function in your gdscript. This way you can keep all of your logic in the Pause menu and no need to use a shortcut
@FlampyPants
@FlampyPants Жыл бұрын
If I hit resume and the pause menu closes I can still hit the quit button even after the pause menu closes, which closes the game
@fnanfne
@fnanfne Жыл бұрын
Add the following to the func _ready() $ColorRect/CenterContainer.hide() Add the following to the func unpause() $ColorRect/CenterContainer.hide() Add the following to the func pause() $ColorRect/CenterContainer.show()
@SimonCrenshaw
@SimonCrenshaw 5 ай бұрын
This Tutorial almost no longer works. The pause menu doesn't show, but functions if it did, and it locks the mouse movement. Although, I'm not sure if this is because of my player layout.
@Sirmatorz
@Sirmatorz 7 ай бұрын
I'm having an issue with this tutorial in 4.2.2.stable where the UI is just tiny and on the side of the screen and i can't get it to be big and in the center and if i do stick it to my character i lose the ability to move my camera since it overrides my mouse input with the control node... I can't seem to find how to fix this so if anyone has a similar issue some help would be greatly aprreciated , thanks lads.
@retrx_x
@retrx_x 2 ай бұрын
in the nodes change mouse to pass instead of ignore in the inspector panel
@CosimoDavideViggiano
@CosimoDavideViggiano Жыл бұрын
for the shortcut: why you don't use the _input(event) function? In my project I wrote in the script: func _input(event): if Input.is_action_just_pressed("pause"): if get_tree().paused: unpause() else: pause() In this way you don't have to navigate in menus and sub menus of components
@purpletrauma
@purpletrauma Жыл бұрын
After reaching the end, and even swapping the pause effect with one I wanted more than the blur shader... I successfully learned the tutorial I used for the player control was incompatible with this code. I think it has something to do with mouse look input also being in "unhandled_event". Or the fact that a find_node function does not appear to be within Godot 4.1.3 Stable. May start again from the top with your tutorials; his work, as much as it felt good to follow the tutorials, is more geared towards an FPS project.
@maucazalv903
@maucazalv903 Жыл бұрын
1. 3:46 they changed it.... where can I see it? 2. I followed the tutorial but there are 2 issues: 1) for some reason it keeps on the blur effect even after pressing resume, I check the keyframaes and blur is on 0 on the unpause animation so idk what´s causing that 2) for some reason after resume the mouse inputs don´t register until a few seconds later... its like it lags
@fansot0592
@fansot0592 Жыл бұрын
same
@RexieRacer
@RexieRacer Жыл бұрын
have you found out how to fix the blur? im having the same problem. EDIT: I fixed it!
@DareChimera
@DareChimera Жыл бұрын
@@RexieRacer You can't just say you fixed it without telling us the fix! What is it???????
@SaiponathGames
@SaiponathGames 2 жыл бұрын
Wow, that can be done via Shortcuts too? I never knew about that, nice!
@jarbarsi
@jarbarsi 2 жыл бұрын
I feel like you overcomplicated the pausing code a bit, if it was me I would've just used _input(event) or _unhandled_input(event) in the pause menu script and toggled the pausing from there just to keep everything in one place func _unhandled_input(event): if event.is_action_just_pressed("ui_cancel"): if get_tree().paused: unpause() else: pause() (also youtube comments really need code blocks....youtube comments really need a lot of things)
@BramwellWilliams
@BramwellWilliams 2 жыл бұрын
Totally valid! I just really like shortcuts and in my experience it isn't quite ideal using whether the tree is paused as a source of truth as then you can't pause in multiple ways, say for opening an inventory as well as a general pause menu. Also really wish it supported code blocks, then i could dump useful stuff in descriptions and pinned comments too :(
@eliyahumedia
@eliyahumedia Жыл бұрын
I tried what you wrote and put it in the pausemenu script but now the look around function of my FPSController does not work. do you know what is causing it and how to fix it?
@delegalco
@delegalco Жыл бұрын
hey i cant seem to get the shader to work can you please help
@danielpineda8661
@danielpineda8661 Жыл бұрын
If your wondering where SCREEN_TEXTURE is it is now uniform sampler2D SCREEN_TEXTURE: hint_screen_texture;
@SimonCrenshaw
@SimonCrenshaw 5 ай бұрын
find_node doesn't work, but the find_child fixed the error.
@nyuh
@nyuh 2 жыл бұрын
yayyy ui stuff
@BramwellWilliams
@BramwellWilliams 2 жыл бұрын
Yasss
@cyphfrix1620
@cyphfrix1620 Жыл бұрын
when making the shader i got an error, i did what the comments told me to do but it didnt work and i got a new error and it said Expected expression, found: 'UNIFORM' what do i do
@RexieRacer
@RexieRacer Жыл бұрын
is uniform in caps?
@bgaming9.
@bgaming9. Жыл бұрын
what should i do if there's already an _unhandled_input(event): function in my character?
@oldvideos-r3u
@oldvideos-r3u Жыл бұрын
just take out _unhandled
@fnanfne
@fnanfne Жыл бұрын
Great tutorial! I've learned so much about stuff I use all the time. I could never get the "duplicate" to do anything in the AnimationPlayer, now it's like facepalm, ta! I see so many comments about things that changed in godot. This is soooooo frustrating, why on earth do they keep on changing things like this? Not cool. Anyhoo, what happened to "find_node()"?? I can't even see any documentation on its disappearance, do we need to use find_child() instead? OOF.
@kaostics-_-
@kaostics-_- Жыл бұрын
How do I make those arrow symbols that you use??
@ThaAftrPartie
@ThaAftrPartie 7 ай бұрын
->
@b4ttlemast0r
@b4ttlemast0r 3 ай бұрын
i just put in the menu script (i created an input action called "pause"): func _input(event: InputEvent) -> void: if event.is_action_pressed("pause"): if get_tree().paused: unpause() else: pause()
@christopheswiderski2026
@christopheswiderski2026 2 жыл бұрын
For the algorithm
@BramwellWilliams
@BramwellWilliams 2 жыл бұрын
👑
@efhunter
@efhunter Жыл бұрын
Really nicely edited tutorial! What should I do if my (2D top down) player isn't always in the center of the screen? (The pause menu pops up centered on the player's position, instead of being centered based on the screen itself)
@dorktales254
@dorktales254 2 жыл бұрын
Godot 4 life
@BramwellWilliams
@BramwellWilliams 2 жыл бұрын
💯
@underbikingrules
@underbikingrules Жыл бұрын
anyone's blur shader not blurring the sky worldenvironment?
@cmdrHeliaxx
@cmdrHeliaxx Жыл бұрын
happens to me to (to my world environment). Found any fix?
@warrenpaul9858
@warrenpaul9858 Жыл бұрын
The issue I had which took me a little bit to find was clicking my left mouse button I thought would crash the game. I realized that the menu is always technically there, just invisible, so I was actually clicking quit every time I left clicked.
@hightekHextress
@hightekHextress Жыл бұрын
I fixed this myself by adding set_process(false) for the unpause function, and set_process(true) for the pause function :)
@cmdrHeliaxx
@cmdrHeliaxx Жыл бұрын
@@hightekHextress Just like that? Doesnt seem to do the trick for me
@AFE-GmdG
@AFE-GmdG 2 жыл бұрын
Nice tutorial. I like the new GD-Script features...
@BramwellWilliams
@BramwellWilliams 2 жыл бұрын
Thanks, me too!
@owenlloyd2528
@owenlloyd2528 Жыл бұрын
Thank you
@hidemat5141
@hidemat5141 2 жыл бұрын
Cool. Godot 4 looks nice.
@Kio_Kurashi
@Kio_Kurashi 2 жыл бұрын
Now I wonder what I would need to do to make sure things aren't clickable behind a window if I were to add in something like a settings menu that is called from here. (or in the way this works: Is "revealed")
@BramwellWilliams
@BramwellWilliams 2 жыл бұрын
Control nodes have a mouse property! if you set mouse mode to ignore the mouse can click things underneath, stop will stop clicks going through c:
@otto2853
@otto2853 4 ай бұрын
They removed "find_node"
@spyro2619
@spyro2619 9 ай бұрын
16:21 nah you're nice
@cmds.learning7426
@cmds.learning7426 2 жыл бұрын
cool!
@cptfurball
@cptfurball 2 жыл бұрын
I think there will be more godot 4.0 coming in soon 😂
@BramwellWilliams
@BramwellWilliams 2 жыл бұрын
Hell yeah!!
@cptfurball
@cptfurball 2 жыл бұрын
@@BramwellWilliams I should make some as well 😂
@alvhawk4461
@alvhawk4461 2 жыл бұрын
damn this broke like everything in my code and ive spent hours trying to fix it but idk ima just not do this and make escape quit the game
@ironhandstudio6612
@ironhandstudio6612 Жыл бұрын
var likeit; likeit = false; var loveit = true whatever!
@TheGl1tchMast3r
@TheGl1tchMast3r 4 ай бұрын
I don't know how quick someone will respond to this, but i'm having some trouble with this code. Firstly, the buttons seem to work fine in the PLAYER scene, however as soon as i test it in the main game scene the buttons do not work. Secondly, within the player scene when the buttons do work, i've added a third button that takes you back to the main menu, however after pressing it none of the scripts within the main menu scene seem to work. code for this is underneath func _on_quit_to_menu_pressed(): get_tree().change_scene_to_packed(menu) apart from these bugs this has been an overall great video, just hope i or someone else can figure what the hell is going on lol.
@TheGl1tchMast3r
@TheGl1tchMast3r 4 ай бұрын
there has also been a variable added for qutting to the menu @onready var quit_to_menu: Button = $"CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Quit to Menu"
@_Micad
@_Micad 8 ай бұрын
get_tree().paused = false does not work anbody know why, same thing with equals true
@metaversegt-official
@metaversegt-official 2 жыл бұрын
Nice video ✨ Can we go DM please ? ✨👀
@me_apps
@me_apps 2 жыл бұрын
with the newer alpha go with @onready var first_button : Button = get_node("CenterContainer/PanelContainer/MarginContainer/VBoxContainer/ResumeButton")
@IThePrototype
@IThePrototype 2 жыл бұрын
Get_tree().paused = true. 18 min video in one sentence.
@camarada_matt
@camarada_matt Жыл бұрын
thank you
The Godot 4 Beta is OUT!
12:44
Bramwell
Рет қаралды 47 М.
Super Easy Pause Menu In Godot 4
16:50
rayuse rp
Рет қаралды 9 М.
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 9 МЛН
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН
I Made My First Game in Godot in 3 Weeks...
26:21
Jack Sather
Рет қаралды 502 М.
How to Make a Pause Game Menu & Pause the Game ~ Godot 4 Tutorial
23:06
Chris' Tutorials
Рет қаралды 34 М.
Tutorial: Stylized Grass in Godot 4
39:26
Bramwell
Рет қаралды 41 М.
I Tried Re-creating Death Stranding Terrain Scan
18:46
Game Dev Buddies
Рет қаралды 164 М.
Easy 3d Menu in Godot 4
18:24
rayuse rp
Рет қаралды 14 М.
Using Composition to Make More Scalable Games in Godot
10:13
Firebelley Games
Рет қаралды 261 М.
How To Make A Game Alone
8:11
Thomas Brush
Рет қаралды 1,2 МЛН
Giving Personality to Procedural Animations using Math
15:30
t3ssel8r
Рет қаралды 2,7 МЛН
Pixel Art Tips from a Professional Artist - Tips & Tricks
8:01
Goodgis
Рет қаралды 1,2 МЛН
I Made the Same Game in 8 Engines
12:34
Emeral
Рет қаралды 4,4 МЛН
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 9 МЛН