Pausing the game
Many games require some sort of pause mode to allow the player to take a break from the action. In Godot, pausing is a function of the SceneTree
and can be set using its paused
property. When the SceneTree
is paused, three things happen:
- The physics thread stops running
-
_process()
and_physics_process()
are no longer called on any nodes - The
_input()
and_input_event()
methods are also not called for inputs
When pause mode is triggered, every node in the running game reacts accordingly, based on how you’ve configured it. This behavior is set via the node’s Process/Mode property, which you’ll find near the bottom of the Inspector list.
The pause mode can be set to the following values:
Inherit
– The node uses the same mode as its parentPausable
– The node pauses when the scene tree is pausedWhen Paused
– The node only runs when the tree is pausedAlways
– The node always...