summaryrefslogtreecommitdiff
path: root/doc/classes/PackedScene.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/PackedScene.xml')
-rw-r--r--doc/classes/PackedScene.xml12
1 files changed, 6 insertions, 6 deletions
diff --git a/doc/classes/PackedScene.xml b/doc/classes/PackedScene.xml
index c7fe7d8c37..7ca1d5d60d 100644
--- a/doc/classes/PackedScene.xml
+++ b/doc/classes/PackedScene.xml
@@ -22,12 +22,12 @@
AddChild(scene);
[/csharp]
[/codeblocks]
- [b]Example of saving a node with different owners:[/b] The following example creates 3 objects: [Node2D] ([code]node[/code]), [RigidDynamicBody2D] ([code]body[/code]) and [CollisionObject2D] ([code]collision[/code]). [code]collision[/code] is a child of [code]body[/code] which is a child of [code]node[/code]. Only [code]body[/code] is owned by [code]node[/code] and [code]pack[/code] will therefore only save those two nodes, but not [code]collision[/code].
+ [b]Example of saving a node with different owners:[/b] The following example creates 3 objects: [Node2D] ([code]node[/code]), [RigidBody2D] ([code]body[/code]) and [CollisionObject2D] ([code]collision[/code]). [code]collision[/code] is a child of [code]body[/code] which is a child of [code]node[/code]. Only [code]body[/code] is owned by [code]node[/code] and [code]pack[/code] will therefore only save those two nodes, but not [code]collision[/code].
[codeblocks]
[gdscript]
# Create the objects.
var node = Node2D.new()
- var body = RigidDynamicBody2D.new()
+ var body = RigidBody2D.new()
var collision = CollisionShape2D.new()
# Create the object hierarchy.
@@ -41,14 +41,14 @@
# Only `node` and `body` are now packed.
var result = scene.pack(node)
if result == OK:
- var error = ResourceSaver.save("res://path/name.tscn", scene) # Or "user://..."
+ var error = ResourceSaver.save(scene, "res://path/name.tscn") # Or "user://..."
if error != OK:
push_error("An error occurred while saving the scene to disk.")
[/gdscript]
[csharp]
// Create the objects.
var node = new Node2D();
- var body = new RigidDynamicBody2D();
+ var body = new RigidBody2D();
var collision = new CollisionShape2D();
// Create the object hierarchy.
@@ -63,7 +63,7 @@
Error result = scene.Pack(node);
if (result == Error.Ok)
{
- Error error = ResourceSaver.Save("res://path/name.tscn", scene); // Or "user://..."
+ Error error = ResourceSaver.Save(scene, "res://path/name.tscn"); // Or "user://..."
if (error != Error.Ok)
{
GD.PushError("An error occurred while saving the scene to disk.");
@@ -92,7 +92,7 @@
<return type="Node" />
<param index="0" name="edit_state" type="int" enum="PackedScene.GenEditState" default="0" />
<description>
- Instantiates the scene's node hierarchy. Triggers child scene instantiation(s). Triggers a [constant Node.NOTIFICATION_INSTANCED] notification on the root node.
+ Instantiates the scene's node hierarchy. Triggers child scene instantiation(s). Triggers a [constant Node.NOTIFICATION_SCENE_INSTANTIATED] notification on the root node.
</description>
</method>
<method name="pack">