Pausing the game
Many games require some sort of pause mode to allow the player to take a break in the action. In Godot, pausing is a function of the scene tree and can be set using get_tree().paused = true
. When the SceneTree
is paused, three things happen:
- The physics thread stops running
_process
and_physics_process
are no longer called, so no code in those methods is run_input
and_input_event
are also not called
When the pause mode is triggered, every node in the running game can react accordingly, based on how you've configured it. This behavior is set via the node's Pause
/Mode
property, which you'll find all the way at the bottom of the Inspector list.
The pause mode can be set to three values: INHERIT
(the default value), STOP
, and PROCESS
. STOP
means the node will cease processing while the tree is paused, while PROCESS
sets the node to continue running, ignoring the paused state of the tree. Because it would be very tedious to set this property on every node in the whole game, INHERIT...