Просмотр исходного кода

Updating change_scene and change_scene_to (#6175)

* Updating change_scene and chnage_scene_to

solves #6156
Kirrby 2 лет назад
Родитель
Сommit
9d9d4b821c

+ 1 - 1
tutorials/best_practices/autoloads_versus_internal_nodes.rst

@@ -6,7 +6,7 @@ Autoloads versus regular nodes
 Godot offers a feature to automatically load nodes at the root of your project,
 allowing you to access them globally, that can fulfill the role of a Singleton:
 :ref:`doc_singletons_autoload`. These auto-loaded nodes are not freed when you
-change the scene from code with :ref:`SceneTree.change_scene <class_SceneTree_method_change_scene>`.
+change the scene from code with :ref:`SceneTree.change_scene_to_file <class_SceneTree_method_change_scene_to_file>`.
 
 In this guide, you will learn when to use the Autoload feature, and techniques
 you can use to avoid it.

+ 1 - 1
tutorials/best_practices/scene_organization.rst

@@ -294,7 +294,7 @@ If one has a system that...
 
   For smaller games, a simpler alternative with less control would be to have
   a "Game" singleton that simply calls the
-  :ref:`SceneTree.change_scene() <class_SceneTree_method_change_scene>` method
+  :ref:`SceneTree.change_scene_to_file() <class_SceneTree_method_change_scene_to_file>` method
   to swap out the main scene's content. This structure more or less keeps
   the "World" as the main game node.
 

+ 2 - 2
tutorials/scripting/change_scenes_manually.rst

@@ -42,8 +42,8 @@ balancing operation speed and memory consumption as well as balancing data
 access and integrity.
 
 1. **We can delete the existing scene.**
-   :ref:`SceneTree.change_scene() <class_SceneTree_method_change_scene>` and
-   :ref:`SceneTree.change_scene_to() <class_SceneTree_method_change_scene_to>`
+   :ref:`SceneTree.change_scene_to_file() <class_SceneTree_method_change_scene_to_file>` and
+   :ref:`SceneTree.change_scene_to_packed() <class_SceneTree_method_change_scene_to_packed>`
    will delete the current scene immediately. Developers can also delete the
    main scene though. Assuming the root node's name is "Main", one could do
    ``get_node("/root/Main").free()`` to delete the whole scene.

+ 4 - 4
tutorials/scripting/scene_tree.rst

@@ -141,14 +141,14 @@ Changing current scene
 
 After a scene is loaded, you may want to change this scene for
 another one. One way to do this is to use the
-:ref:`SceneTree.change_scene() <class_SceneTree_method_change_scene>`
+:ref:`SceneTree.change_scene_to_file() <class_SceneTree_method_change_scene_to_file>`
 function:
 
 .. tabs::
  .. code-tab:: gdscript GDScript
 
     func _my_level_was_completed():
-        get_tree().change_scene("res://levels/level2.tscn")
+        get_tree().change_scene_to_file("res://levels/level2.tscn")
 
  .. code-tab:: csharp
 
@@ -160,7 +160,7 @@ function:
 Rather than using file paths, one can also use ready-made
 :ref:`PackedScene <class_PackedScene>` resources using the equivalent
 function
-:ref:`SceneTree.change_scene_to(PackedScene scene) <class_SceneTree_method_change_scene_to>`:
+:ref:`SceneTree.change_scene_to_packed(PackedScene scene) <class_SceneTree_method_change_scene_to_packed>`:
 
 .. tabs::
  .. code-tab:: gdscript GDScript
@@ -168,7 +168,7 @@ function
     var next_scene = preload("res://levels/level2.tscn")
 
     func _my_level_was_completed():
-    	get_tree().change_scene_to(next_scene)
+    	get_tree().change_scene_to_packed(next_scene)
 
  .. code-tab:: csharp
 

+ 3 - 3
tutorials/scripting/singletons_autoload.rst

@@ -115,7 +115,7 @@ Custom scene switcher
 
 This tutorial will demonstrate building a scene switcher using autoloads.
 For basic scene switching, you can use the
-:ref:`SceneTree.change_scene() <class_SceneTree_method_change_scene>`
+:ref:`SceneTree.change_scene_to_file() <class_SceneTree_method_change_scene_to_file>`
 method (see :ref:`doc_scene_tree` for details). However, if you need more
 complex behavior when changing scenes, this method provides more functionality.
 
@@ -208,7 +208,7 @@ current scene and replace it with the requested one.
         # Add it to the active scene, as child of root.
         get_tree().root.add_child(current_scene)
 
-        # Optionally, to make it compatible with the SceneTree.change_scene() API.
+        # Optionally, to make it compatible with the SceneTree.change_scene_to_file() API.
         get_tree().current_scene = current_scene
 
  .. code-tab:: csharp
@@ -241,7 +241,7 @@ current scene and replace it with the requested one.
         // Add it to the active scene, as child of root.
         GetTree().Root.AddChild(CurrentScene);
 
-        // Optionally, to make it compatible with the SceneTree.change_scene() API.
+        // Optionally, to make it compatible with the SceneTree.change_scene_to_file() API.
         GetTree().CurrentScene = CurrentScene;
     }