Parent
- A node
Parent
is its parent tree scene
Owner
- A node
Owner
may be any other than its effective parent node (parent) or grandparent (grandparent) upper node i.e. node of the tree - When a storage node that it owns node also will be saved
- If you do not change the default
Owner
, you can take it as a scene where the top node, if the node itself is the top node then itOwner
isnull
Experiment 1: static scene structure defaultOwner
Code of each node is the same
extends Node
class_name TestNode
func _ready():
var parent_name = "NULL"
var owner_name = "NULL"
if get_parent() != null:
parent_name = get_parent().name
if owner != null:
owner_name = owner.name
print(name + "'s parent is <" + parent_name + "> and it's owner is <" + owner_name + ">" )
Output
node_3's parent is <node_2> and it's owner is <node_0>
node_2's parent is <node_1> and it's owner is <node_0>
node_1's parent is <node_0> and it's owner is <node_0>
node_0's parent is <root> and it's owner is <NULL>
Experiment two: dynamically created nodeOwner
extends Node
func _ready():
var n = TestNode.new()
n.name = "<the one created in runtime>"
add_child(n)
Output
<the one created in runtime>'s parent is <node> and it's owner is <NULL>
summary
- Default static generated node
Owner
is its parent, if it has no parent isOwner
- Dynamically generated default node
Owner
isnull