【Godot】Pause Control with Process Mode

Created: 2025-06-20Last updated: 2025-12-06

Understanding Node Process Mode mechanics and configuration. Usage examples for pause functionality and dialog displays

Overview

In game development, pause functionality is essential for letting players take a break or change settings. Godot provides mechanisms for implementing this pause functionality surprisingly easily and flexibly. At the center of this is "Process Mode."

This article explains the basics of Godot's pause functionality and the Process Mode concept in a beginner-friendly way.

Process Mode Settings Screen

Basics of Pausing the Game

Pausing the entire game in Godot takes just one line of code.

# Pause the game
get_tree().paused = true

# Resume the game
get_tree().paused = false

get_tree() gets the current scene tree, and setting its paused property to true makes Godot stop physics calculations and halt processing for most nodes. However, "most" is the key point. Process Mode determines which nodes are affected by the pause.

What is Process Mode?

Process Mode is a setting that determines how each node behaves according to the game's pause state. It can be set from the Node properties in the Inspector.

Process Mode Settings Screen
ModeDescription
Inherit(Inherit) Follows parent node's setting. This is the default.
Pausable(Pausable) When game is paused, stops processing (_process, _physics_process, etc.).
WhenPaused(When Paused) Processes only while the game is paused. Perfect for pause menus.
Always(Always) Always continues processing regardless of pause state.
Disabled(Disabled) Never processes. Use when temporarily disabling a node.

Practical Example: Creating a Pause Menu

The most common use of Process Mode is for pause menus. While the game is paused, menu buttons still need to be operable.

1. Create Pause Menu Scene

Create a pause menu scene (e.g., PauseMenu.tscn) with a Control node as root and "Resume" and "Quit" Button nodes underneath.

2. Set Process Mode

Select the pause menu scene's root node (Control node) and change Process Mode to WhenPaused in the Inspector. This makes the menu only display and operate when the game is paused.

3. Implement Pause Processing

Add the following to a script that receives input, like the player or main scene.

# Set PauseMenu.tscn from Inspector
@export var pause_menu_scene: PackedScene

var pause_menu_instance

func _unhandled_input(event):
    if event.is_action_just_pressed("pause_game"): # "pause_game" set in InputMap
        if get_tree().paused:
            # Resume game
            get_tree().paused = false
            if pause_menu_instance:
                pause_menu_instance.queue_free() # Delete menu
        else:
            # Pause game
            get_tree().paused = true
            pause_menu_instance = pause_menu_scene.instantiate()
            add_child(pause_menu_instance) # Add menu to scene

This code toggles get_tree().paused state when the pause button is pressed, instantiating and destroying the pause menu. Since Process Mode is set to WhenPaused, the menu only functions while paused.

Summary

Combining get_tree().paused with Process Mode allows very intuitive pause functionality implementation in Godot. Just keeping characters and effects as Pausable (default) while setting only UI to WhenPaused will make your game behave more professionally.