> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/godotengine/godot/llms.txt
> Use this file to discover all available pages before exploring further.

# SceneTree

# 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

<ResponseField name="current_scene" type="Node">
  The root node of the currently loaded main scene.
</ResponseField>

<ResponseField name="paused" type="bool" default="false">
  If true, the scene tree is considered paused. Physics and processing stop.
</ResponseField>

<ResponseField name="root" type="Window">
  The tree's root Window. This is the top-most Node of the scene tree.
</ResponseField>

## Methods

### change\_scene\_to\_file

```gdscript theme={null}
Error change_scene_to_file(path: String)
```

Changes the running scene to the one at the given path.

<ParamField path="path" type="String">
  Path to the scene file to load
</ParamField>

### change\_scene\_to\_packed

```gdscript theme={null}
Error change_scene_to_packed(packed_scene: PackedScene)
```

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

### create\_timer

```gdscript theme={null}
SceneTreeTimer create_timer(time_sec: float, process_always: bool = true)
```

Returns a new SceneTreeTimer. After time\_sec seconds, the timer will emit timeout.

### reload\_current\_scene

```gdscript theme={null}
Error reload_current_scene()
```

Reloads the currently active scene.

### quit

```gdscript theme={null}
void quit(exit_code: int = 0)
```

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

<Tabs>
  <Tab title="GDScript">
    ```gdscript theme={null}
    # Access the scene tree
    var tree = get_tree()

    # Change scene
    tree.change_scene_to_file("res://scenes/main_menu.tscn")

    # Create a timer
    var timer = tree.create_timer(2.0)
    timer.timeout.connect(func(): print("Timer finished"))

    # Pause the game
    tree.paused = true
    ```
  </Tab>

  <Tab title="C#">
    ```csharp theme={null}
    // Access the scene tree
    var tree = GetTree();

    // Change scene
    tree.ChangeSceneToFile("res://scenes/main_menu.tscn");

    // Pause the game
    tree.Paused = true;
    ```
  </Tab>
</Tabs>
