36. Nodes, parents, paths and ownership
func run() -> bool:
var marker := Node.new()
marker.name = "TutorialMarker"
add_child(marker)
var found: Node = get_node_or_null("TutorialMarker")
var correct: bool = found == marker
marker.queue_free()
return correctA Node belongs to one parent. add_child places it in the tree; queue_free schedules its deletion. Use get_node_or_null when absence is acceptable. A leading slash is an absolute path from the SceneTree root; relative paths begin at the calling node.
A PCA script is parented under the script engine, not under the door that called it. $Mesh means a child of the script node. It does not search the rendered door model. %UniqueName depends on Godot scene ownership and a unique-name setup, not a PCA record ID.
Node.owner controls what can be included when packing a Godot scene. It is not the same as parent, PCA’s this, inventory ownership or the active player. For runtime-only nodes, a correct parent/lifetime is usually the first concern.
