Skip to content

Commit

Permalink
enhance comments and replace incorrect danger tag with tip
Browse files Browse the repository at this point in the history
  • Loading branch information
betalars committed Jan 23, 2025
1 parent 65a7473 commit a5fa88b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tutorials/plugins/running_code_in_the_editor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -616,20 +616,22 @@ as the scene root:
.. code-tab:: gdscript GDScript
# Either add dynamic children at ready:
func _ready():
# Generates a fence each time the node is ready:
add_dynamic_fence()

# Or create a persistent fence once:
func add_persistent_fence():
var fence_instance = preload("res://Models/Fence01.tscn").instantiate()
add_child(fence_instance)

# Sets child owner to scene root so it is visible in the scene dock and persistent.
# Sets child owner to scene root so it is persistent.
fence_instance.owner = get_tree().edited_scene_root

.. code-tab:: csharp C#
// Either add dynamic children at ready:
public override void _Ready()
{
// Generates a fence each time the node is ready:
AddDynamicFence();
}

Expand All @@ -639,11 +641,11 @@ as the scene root:
var node = new Node3D();
AddChild(node); // Parent could be any node in the scene

// Sets child owner to scene root so it is visible in the scene dock and persistent.
// Sets child owner to scene root so it is persistent.
node.Owner = GetTree().EditedSceneRoot;
}

.. danger::
.. tip::
Instanced Scenes cannot set their children's :ref:`owner <class_Node_property_owner>`
as the scene root, but can store scene-specific persistent settings in their properties.

Expand Down

0 comments on commit a5fa88b

Please sign in to comment.