33Change scenes manually
44======================
55
6- Sometimes it helps to have more control over how one swaps scenes around.
6+ Sometimes it helps to have more control over how you swap scenes around.
77A :ref: `Viewport <class_Viewport >`'s child nodes will render to the image
8- it generates, this holds true even for nodes outside
9- of the "current" scene. Autoloads fall into this category, but so do
10- scenes which one instances and adds to the tree at runtime:
8+ it generates. This holds true even for nodes outside of the "current"
9+ scene. Autoloads fall into this category, and also scenes which you
10+ instantiate and add to the tree at runtime:
1111
1212.. tabs ::
1313 .. code-tab :: gdscript GDScript
@@ -36,16 +36,16 @@ scenes which one instances and adds to the tree at runtime:
3636 }
3737
3838To complete the cycle and swap out the new scene with the old one,
39- developers have a choice to make. Many strategies exist for removing a scene
39+ you have a choice to make. Many strategies exist for removing a scene
4040from view of the :ref: `Viewport <class_Viewport >`. The tradeoffs involve
41- balancing operation speed and memory consumption as well as balancing data
41+ balancing operation speed and memory consumption, as well as balancing data
4242access and integrity.
4343
44- 1. **We can delete the existing scene. **
44+ 1. **Delete the existing scene. **
4545 :ref: `SceneTree.change_scene_to_file() <class_SceneTree_method_change_scene_to_file >` and
4646 :ref: `SceneTree.change_scene_to_packed() <class_SceneTree_method_change_scene_to_packed >`
47- will delete the current scene immediately. Developers can also delete the
48- main scene though . Assuming the root node's name is "Main", one could do
47+ will delete the current scene immediately. You can also delete the
48+ main scene. Assuming the root node's name is "Main", you could do
4949 ``get_node("/root/Main").free() `` to delete the whole scene.
5050
5151 - Unloads memory.
@@ -65,60 +65,60 @@ access and integrity.
6565
6666 - Processing stops.
6767
68- - Pro: No nodes means no process , physics process , or input
68+ - Pro: No nodes means no processing , physics processing , or input
6969 handling. The CPU is available to work on the new scene's contents.
7070
7171 - Con: Those nodes' processing and input handling no longer operate.
7272 Not a problem if using the updated data is unnecessary.
7373
74- 2. **We can hide the existing scene. ** By changing the visibility or collision
75- detection of the nodes, we can hide the entire node sub-tree from the
74+ 2. **Hide the existing scene. ** By changing the visibility or collision
75+ detection of the nodes, you can hide the entire node sub-tree from the
7676 player's perspective.
7777
7878 - Memory still exists.
7979
80- - Pro: One can still access the data if need be .
80+ - Pro: You can still access the data if needed .
8181
8282 - Pro: There's no need to move any more nodes around to save data.
8383
84- - Con: More data is being kept in memory which will become a problem
84+ - Con: More data is being kept in memory, which will be become a problem
8585 on memory-sensitive platforms like web or mobile.
8686
8787 - Processing continues.
8888
8989 - Pro: Data continues to receive processing updates, so the scene will
90- keep updated any data within it that relies on delta time or frame
91- data .
90+ keep any data within it that relies on delta time or frame data
91+ updated .
9292
9393 - Pro: Nodes are still members of groups (since groups belong to the
9494 :ref: `SceneTree <class_SceneTree >`).
9595
9696 - Con: The CPU's attention is now divided between both scenes. Too much
97- load could result in low frame rates. One should be sure to test
98- performance as they go to ensure the target platform can support the
99- load they are giving it .
97+ load could result in low frame rates. You should be sure to test
98+ performance as you go to ensure the target platform can support the
99+ load from this approach .
100100
101- 3. **We can remove the existing scene from the tree. ** Assign a variable
101+ 3. **Remove the existing scene from the tree. ** Assign a variable
102102 to the existing scene's root node. Then use
103103 :ref: `Node.remove_child(Node) <class_Node_method_remove_child >` to detach the entire
104104 scene from the tree.
105105
106- - Memory still exists (similar pros/cons as with hiding it from view).
106+ - Memory still exists (similar pros/cons as hiding it from view).
107107
108- - Processing stops (similar pros/cons as with deleting it completely).
108+ - Processing stops (similar pros/cons as deleting it completely).
109109
110110 - Pro: This variation of "hiding" it is much easier to show/hide. Rather
111- than potentially keeping track of multiple changes to the scene, one
112- must only call the one method add/remove_child pair of methods. It is
113- similar to disabling game objects in other engines.
111+ than potentially keeping track of multiple changes to the scene, you
112+ only need to call the add/remove_child methods. This is similar to
113+ disabling game objects in other engines.
114114
115115 - Con: Unlike with hiding it from view only, the data contained within
116116 the scene will become stale if it relies on delta time, input, groups,
117117 or other data that is derived from :ref: `SceneTree <class_SceneTree >`
118118 access.
119119
120- There are also cases where one may wish to have many scenes present at the same
121- time. Perhaps one is adding their own singleton at runtime, or preserving
120+ There are also cases where you may wish to have many scenes present at the same
121+ time, such as adding your own singleton at runtime, or preserving
122122a scene's data between scene changes (adding the scene to the root node).
123123
124124.. tabs ::
@@ -130,11 +130,11 @@ a scene's data between scene changes (adding the scene to the root node).
130130
131131 GetTree().Root.AddChild(scene);
132132
133- Perhaps instead they wish to display multiple scenes at the same time using
134- :ref: `SubViewportContainers <class_SubViewportContainer >`. This is optimal in
135- cases where the intent is to render different content in different parts of the
136- screen. Minimaps and split-screen multiplayer are good examples .
133+ Another case may be displaying multiple scenes at the same time using
134+ :ref: `SubViewportContainers <class_SubViewportContainer >`. This is optimal for
135+ rendering different content in different parts of the screen (e.g. minimaps,
136+ split-screen multiplayer) .
137137
138- Each option will have cases where it is best appropriate, so one must
139- examine the effects of each and determine what path best fits
140- their unique situation.
138+ Each option will have cases where it is best appropriate, so you must examine
139+ the effects of each approach, and determine what path best fits your unique
140+ situation.
0 commit comments