IF YOU'RE COMING HERE IN 2023: This tutorial holds up. HOWEVER, make sure you set the control node's "Process" mode to "Always". He explains it here 5:22, except in 4.0, Pause Mode is renamed to "Process". You can also shorthand "not get_tree().paused" to "!get_tree().paused" if you really wanted to.
Your method was working flawlessly when I used visible=true under func _ready(). Before that the pause menu was always visible when the scene was loaded for the first time. Anyway great tut!
@@link_nukem LOL I actually forgot how I did it. It was a long time ago and I am quite busy now, but, I can give you my github repo if that helps. Good Luck! github.com/souvikban16/firstgame. Its under /UI/pausemenu.gd
Hello GDQest. This tutorial is great. However, I'd like to ask you: Is there a way in which I can only pause the HUD? I'm making a racing game and I want the HUD time to stop when the race finishes. I just don't know how. Could you help me please?
im trying to make it where if you pause the mouse becomes visible, as in the game it is hidden. so how to I write a set of code so that when paused, the mouse is visible for as long as it is paused?
to hide the mouse: Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) to show the mouse: Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) hope it helps! (sorry if i have bad english)
The tutorial is good but it would be great if you activate the subtitles to understand better. Esta bueno el tutorial pero seria genial que actives los subtítulos para entender mejor.
Hey but this doesn't seem to work on the below code yield(get_tree().create_timer(1), "timeout") as the yield function is running without respecting the tree pause. Is there any way to pause the yield function in GoDot. By the way all of your tutorials are outstanding :)
I use Engine.time_scale = 0 and Engine.time_scale = 1 (or a greater number) for pausing my game, I believe this also stops timers. Not sure if this is a good way to pause the game..
That's probably because the timer you create doesn't inherit the pause state from the tree. Just use another timer object that does or redesign your coroutine.
Jumping in here a year later with the solution I just found because I read this while trying to solve the same problem... Timers have a second parameter "pause_mode_process", which defaults to true. To make them stop during pause, you need to add false after the time, like this: yield(get_tree().create_timer(1, false), "timeout") I hope this helps someone!
if your get_tree().paused is not paused then it means false, if it is paused it means true. By setting it as a variable first he sets up a false or true based on the opposite of the paused state. So if you click pause it goes to the code, sees that it is not paused (i.e. false) and sets the state of the variable to True, it then changes the paused state to true and the visibility of the pause screen to true. The opposite happens if you select the pause button when it is paused.
godot docs says when get_tree().paused = true then _input and _input_event wont be called anymore. anyway, for me it worked changing the pause mode from inherit to process
I'm probably not going to get an answer but no harm is done if I ask it anyways: When I change a scene, the pausing doesn't work anymore; in addition to that, when I tried to create a pause menu scene and then put it in the Level 2 scene, it lost the centralized look and the color. Any solutions?
you need to create a scene for the control node only then import it into other scenes using the "instance a scene file as a node" button next to the add node button hope this helps! (sorry if i have bad english)
All nodes in your tree will be paused unless you mark them as such via Process in the menu. He essentially makes it where your code will grab all of your nodes in your tree.
i copied the exact code but everytime I get the same error E 0:00:04.579 event_get_action_status: Request for nonexistent InputMap action 'ui.pause'. Condition "!E" is true. Returned: false core/input_map.cpp:195 @ event_get_action_status() Pause.gd:4 @ _input()
@@ladyvampire4979 The error is telling you that the input action you're requesting, here "ui.pause", doesn't exist, and that's most likely because it's still undefined in your project. To add it, go to Project -> Project Settings -> Input Map tab, and enter "pause" in the Action bar. Press enter, navigate down the window to the action, and assign it some keys by clicking the "+" button next to it.
Deve ser por cause do Open GL 3, espera a versão 3.1 sair e recompila, tenho quase certeza que vai funcionar, a não ser que você tenha usado shaders, aí eu não sei, mas é provável que sim.
It does! In Godot 3.0 probably, or whichever version this tutorial covered. The code may not work 1:1 in Godot 3.2, it's up to the viewer to find the functions that may have been renamed in this case.
This is the first video in the history of youtube that I see without the possibility of activate automatic subtitles! Congratulations for your xenophobia! Lol