Godot 4 Pause Menu Tutorial

In this tutorial, I’m going to walk you through how to build a simple pause menu in Godot 4. For this project, it's assumed that you already have a base game (or at the very least a main.tscn scene you're working with). In this tutorial, we'll be adding to our main scene by building out a custom pause menu scene with Godot's Control node and adding a little bit of GDScript.

For this tutorial, I'm using Godot version 4.6.1. However, this method will work for any Godot 4+ version.


Building the pause menu

The first thing you'll need to do is create a new scene with the root node being of type CanvasLayer. Then, add a Control node and name it PauseMenu.

Inside your PauseMenu, add:

  • A Panel
  • A VBoxContainer

Inside the VBoxContainer, add:

  • A Label
  • A Button (Resume)
  • A Button (Quit)
Example of full node tree for new scene pause_menu
Example of Node tree at this point

Set things up like this:

  • Change the process mode to When Paused
    • Example of setting Process to 'when paused'
  • Make the Panel stretch across the screen
  • Center the VBoxContainer using layout anchors
  • Set the label text to: Game Paused
  • Rename your buttons to:
    • Resume
    • Quit

You can tweak sizes and spacing however you want.


Adding It To Your Main Scene

Now just instance your PauseMenu scene into your main scene. You can do this by opening your main .tscn file, then drag & drop the new pause_scene file into the scene tree on the left-hand side. Make sure your new node is directly within the root node of your main scene and overlaps all other nodes.

At this point, if you run your game, the pause menu will just sit there doing nothing. That’s expected.

For example:

Example of pause menu in Godot 4


Main Scene's Script Setup

Before implementing our script, we need to configure our pause button. For my example, I'll be using the ui_cancel key. My project comes with this pre configured as the ESC key. To check if yours is preconfigured, or add your own key, located the project option in the upper left-hand corner of the screen. Click on it and select Project Settings from the drop down. Then inside of the popup window, select Input Map and enter ui_cancel into the search field.

Attach a script to your main scene and add the following code. If you already have a script attached to your main scene, do not attach a new script.

@onready var pause_menu = $PauseMenu
func _ready():
pause_menu.visible = false
func _process(delta):
if Input.is_action_just_pressed("ui_cancel"):
toggle_pause()
func toggle_pause():
get_tree().paused = !get_tree().paused
pause_menu.visible = get_tree().paused

What’s happening here:

  • pause_menu.visible = false - Initializes the pause menu to be invisible.
  • if Input.is_action_just_pressed("ui_cancel"): - We are toggling the pause menu when the ui_cancel button (ESC key) is clicked.
  • toggle_pause() - we are setting the pause state of the game = to the opposite of the current state, then setting the visibility of the pause menu equal to that. So if the game is unpaused (false), we are setting it to true, pausing the game. Then we are also setting the visability of the pause menu to true.

Show or hide the menu based on that state

If Escape isn’t working, check: Project Settings → Input Map → ui_cancel

Make The Menu Work While Paused Select your PauseMenu node and set:

Process Mode → When Paused


PauseMenu script & Button Setup

Now add a script to your PauseMenu.

Resume Button

The first step is selecting the button symbol. Inside of you pause_menu.tscn, select the resume button node from the Scene tree on the left-hand side. Then, on the right-hand side, select Signals. You should see a signal here called pressed(). Double click on that signal. Then, inside of the new popup window, make sure you have PauseMenu selected (MUST be the node that you setup your new PauseMenu script in), and click Connect. You should see a new function populate in your GDScript file. Inside of this function, you can add the provided code to unpause your game and set the PauseMenu back to invisible.

Example of selecting pressed() signal
Example of selecting pressed() signal for Godot 4 button
Example of connecting Godot button to script
Example of connecting the pressed action to the script

func _on_resume_pressed():
get_tree().paused = false
visible = false

Quit Button

We can do the same thing with our quit button. Select the quit button, select signals on the right-hand side menu, and select the pressed signal, ad connect it to our PauseMenu.

Then we can add our quit script

func _on_quit_pressed():
# save code goes here...
get_tree().quit()

If you have a save system, you will want to call your save function before get_tree().quit().

Final Result

Now, when you run your game:

  • Press Escape → game pauses and menu shows up
  • Press Resume → game continues
  • Press Quit → game closes

That’s it. You now have a fully functional basic setup of a pause menu! From here, you can build on it however you want. Settings menu, audio sliders, save/load, whatever fits your game.

If something is not working, go back through and double check:

  1. Process mode is set correctly
  2. Input map includes ui_cancel
  3. Your node paths are correct

If you found this guide helpful, be sure to checkout my Youtube channel for more Godot tutorials, tips, and tricks that will help you level up your game development skills!