If you need the child node to be added below a specific node in the list of children, use [method add_child_below_node] instead of this method.
If you need the child node to be added below a specific node in the list of children, use [method add_sibling] instead of this method.
[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://godot.readthedocs.io/en/latest/tutorials/misc/running_code_in_the_editor.html]tool scripts[/url] and [url=https://godot.readthedocs.io/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.
Adds a child node below the [code]preceding_node[/code].
Adds a [code]sibling[/code] node to current's node parent, at the the same level as that node, right below it.
If [code]legible_unique_name[/code] is [code]true[/code], the child node will have an human-readable name based on the name of the node being instanced instead of its type.
Use [method add_child] instead of this method if you don't need the child node to be added below a specific node in the list of children.
ERR_FAIL_COND_MSG(p_sibling==this,"Can't add sibling '"+p_sibling->get_name()+"' to itself.");// adding to itself!
ERR_FAIL_COND_MSG(data.blocked>0,"Parent node is busy setting up children, add_sibling() failed. Consider using call_deferred(\"add_sibling\", sibling) instead.");
if(is_a_parent_of(p_node)){
move_child(p_child,p_node->get_index()+1);
}else{
WARN_PRINT("Cannot move under node "+p_node->get_name()+" as "+p_child->get_name()+" does not share a parent.");