diff --git a/tutorials/scripting/singletons_autoload.rst b/tutorials/scripting/singletons_autoload.rst index 321968827..04adbc7b5 100644 --- a/tutorials/scripting/singletons_autoload.rst +++ b/tutorials/scripting/singletons_autoload.rst @@ -146,7 +146,7 @@ means that the last child of root is always the loaded scene. var current_scene = null func _ready(): - var root = get_tree().get_root() + var root = get_tree().root current_scene = root.get_child(root.get_child_count() - 1) .. code-tab:: csharp @@ -160,7 +160,7 @@ means that the last child of root is always the loaded scene. public override void _Ready() { - Viewport root = GetTree().GetRoot(); + Viewport root = GetTree().Root; CurrentScene = root.GetChild(root.GetChildCount() - 1); } } @@ -195,10 +195,10 @@ current scene and replace it with the requested one. current_scene = s.instance() # Add it to the active scene, as child of root. - get_tree().get_root().add_child(current_scene) + get_tree().root.add_child(current_scene) # Optionally, to make it compatible with the SceneTree.change_scene() API. - get_tree().set_current_scene(current_scene) + get_tree().current_scene = current_scene .. code-tab:: csharp @@ -228,10 +228,10 @@ current scene and replace it with the requested one. CurrentScene = nextScene.Instance(); // Add it to the active scene, as child of root. - GetTree().GetRoot().AddChild(CurrentScene); + GetTree().Root.AddChild(CurrentScene); // Optionally, to make it compatible with the SceneTree.change_scene() API. - GetTree().SetCurrentScene(CurrentScene); + GetTree().CurrentScene = CurrentScene; } Using :ref:`Object.call_deferred() `,