The node owner. A node can have any other node as owner (as long as it is a valid parent, grandparent, etc. ascending in the tree). When saving a node (using [PackedScene]), all the nodes it owns will be saved with it. This allows for the creation of complex [SceneTree]s, with instancing and subinstancing. [b]Note:[/b] If you want a child to be persisted to a [PackedScene], you must set [member owner] in addition to calling [method add_child]. This is typically relevant for [url=https://docs.rebeltoolbox.com/en/latest/tutorials/misc/running_code_in_the_editor.html]tool scripts[/url] and [url=https://docs.rebeltoolbox.com/en/latest/tutorials/plugins/editor/index.html]editor plugins[/url]. If [method add_child] is called without setting [member owner], the newly added [Node] will not be visible in the scene tree, though it will be visible in the 2D/3D view.
Añade un nodo infantil. Los nodos pueden tener cualquier número de niños, pero cada niño debe tener un nombre único. Los nodos hijos se eliminan automáticamente cuando se elimina el nodo padre, por lo que una escena entera puede ser eliminada eliminando su nodo superior. Si [code]legible_unique_name[/code] es [code]true[/code], el nodo hijo tendrá un nombre legible para los humanos basado en el nombre del nodo que se instale en lugar de su tipo. [b]Nota:[/b] Si el nodo hijo ya tiene un padre, la función fallará. Use [method remove_child] primero para eliminar el nodo de su padre actual. Por ejemplo: [codeblock] if child_node.get_parent(): child_node.get_parent().remove_child(child_node) add_child(child_node) [/codeblock] Si necesita que el nodo hijo se añada debajo de un nodo específico en la lista de hijos, use [method add_sibling] en lugar de este método. [b]Nota:[/b] Si quieres que un hijo sea perseguido en un [PackedScene], debes establecer [member owner] además de llamar a [method add_child]. Esto es típicamente relevante para los scripts de la herramienta [url=https://godot.readthedocs.io/es/latest/tutorials/misc/running_code_in_the_editor.html]tool[/url] y para los plugins de edición [/url] de [url=https://godot.readthedocs.io/es/latest/tutorials/plugins/editor/index.html]. Si se llama a [method add_child] sin establecer [member owner], el [Node] recién agregado no será visible en el árbol de la escena, aunque sí lo será en la vista 2D/3D.
[b]Note:[/b] If you want a child to be persisted to a [PackedScene], you must set [member owner] in addition to calling [method add_child]. This is typically relevant for [url=https://docs.rebeltoolbox.com/en/latest/tutorials/misc/running_code_in_the_editor.html]tool scripts[/url] and [url=https://docs.rebeltoolbox.com/en/latest/tutorials/plugins/editor/index.html]editor plugins[/url]. If [method add_child] is called without setting [member owner], the newly added [Node] will not be visible in the scene tree, though it will be visible in the 2D/3D view.
Si [code]legible_unique_name[/code] es [code]true[/code], el nodo hijo tendrá un nombre legible para los humanos basado en el nombre del nodo que se instale en lugar de su tipo.
[b]Nota:[/b] Si el nodo hijo ya tiene un padre, la función fallará. Use [method remove_child] primero para eliminar el nodo de su padre actual. Por ejemplo:
[codeblock]
if child_node.get_parent():
child_node.get_parent().remove_child(child_node)
add_child(child_node)
[/codeblock]
Si necesita que el nodo hijo se añada debajo de un nodo específico en la lista de hijos, use [method add_sibling] en lugar de este método.
[b]Nota:[/b] Si quieres que un hijo sea perseguido en un [PackedScene], debes establecer [member owner] además de llamar a [method add_child]. Esto es típicamente relevante para los scripts de la herramienta [url=https://godot.readthedocs.io/es/latest/tutorials/misc/running_code_in_the_editor.html]tool[/url] y para los plugins de edición [/url] de [url=https://godot.readthedocs.io/es/latest/tutorials/plugins/editor/index.html]. Si se llama a [method add_child] sin establecer [member owner], el [Node] recién agregado no será visible en el árbol de la escena, aunque sí lo será en la vista 2D/3D.