Skip to main content

SceneTree

Inherits: MainLoop < Object

Description

Manages the game loop via a hierarchy of nodes. The SceneTree manages the hierarchy of nodes in a scene, as well as scenes themselves. It’s in charge of the game loop.

Properties

Node
The root node of the currently loaded main scene.
bool
default:"false"
If true, the scene tree is considered paused. Physics and processing stop.
Window
The tree’s root Window. This is the top-most Node of the scene tree.

Methods

change_scene_to_file

Changes the running scene to the one at the given path.
String
Path to the scene file to load

change_scene_to_packed

Changes the running scene to a new instance of the given PackedScene.

create_timer

Returns a new SceneTreeTimer. After time_sec seconds, the timer will emit timeout.

reload_current_scene

Reloads the currently active scene.

quit

Quits the application at the end of the current iteration.

Signals

tree_changed()

Emitted any time the tree’s hierarchy changes.

process_frame()

Emitted immediately before Node._process is called on every node in this tree.

physics_frame()

Emitted immediately before Node._physics_process is called on every node.

Example Usage