Skip to content

Commit 3b6184e

Browse files
authored
Merge pull request #7441 from br1trs/delete-get-root
2 parents 7afa05e + 92d962a commit 3b6184e

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

tutorials/inputs/handling_quit_requests.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ program termination, you should send the notification yourself:
7878
.. tabs::
7979
.. code-tab:: gdscript GDScript
8080

81-
get_tree().get_root().propagate_notification(NOTIFICATION_WM_CLOSE_REQUEST)
81+
get_tree().root.propagate_notification(NOTIFICATION_WM_CLOSE_REQUEST)
8282

8383
.. code-tab:: csharp
8484

tutorials/rendering/multiple_resolutions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ little easier. The :ref:`Viewport <class_Viewport>`
109109
node has several functions to handle resizing, and the root node of the
110110
scene tree is always a viewport (scenes loaded are instanced as a child
111111
of it, and it can always be accessed by calling
112-
``get_tree().get_root()`` or ``get_node("/root")``).
112+
``get_tree().root`` or ``get_node("/root")``).
113113

114114
In any case, while changing the root Viewport params is probably the
115115
most flexible way to deal with the problem, it can be a lot of work,

tutorials/scripting/change_scenes_manually.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ scenes which one instances and adds to the tree at runtime:
1717
func _add_a_scene_manually():
1818
# This is like autoloading the scene, only
1919
# it happens after already loading the main scene.
20-
get_tree().get_root().add_child(simultaneous_scene)
20+
get_tree().root.add_child(simultaneous_scene)
2121

2222
.. code-tab:: csharp
2323

@@ -32,7 +32,7 @@ scenes which one instances and adds to the tree at runtime:
3232
{
3333
// This is like autoloading the scene, only
3434
// it happens after already loading the main scene.
35-
GetTree().GetRoot().AddChild(simultaneousScene);
35+
GetTree().Root.AddChild(simultaneousScene);
3636
}
3737

3838
To complete the cycle and swap out the new scene with the old one,
@@ -124,11 +124,11 @@ a scene's data between scene changes (adding the scene to the root node).
124124
.. tabs::
125125
.. code-tab:: gdscript GDScript
126126

127-
get_tree().get_root().add_child(scene)
127+
get_tree().root.add_child(scene)
128128

129129
.. code-tab:: csharp
130130

131-
GetTree().GetRoot().AddChild(scene);
131+
GetTree().Root.AddChild(scene);
132132

133133
Perhaps instead they wish to display multiple scenes at the same time using
134134
:ref:`SubViewportContainers <class_SubViewportContainer>`. This is optimal in

tutorials/scripting/scene_tree.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ two different ways:
6969
.. tabs::
7070
.. code-tab:: gdscript GDScript
7171

72-
get_tree().get_root() # Access via scene main loop.
72+
get_tree().root # Access via scene main loop.
7373
get_node("/root") # Access via absolute path.
7474

7575
.. code-tab:: csharp
7676

77-
GetTree().GetRoot(); // Access via scene main loop.
77+
GetTree().Root // Access via scene main loop.
7878
GetNode("/root"); // Access via absolute path.
7979

8080
This node contains the main viewport. Anything that is a child of a

0 commit comments

Comments
 (0)