Godot: rename add_child to add_node

Created on 4 Jun 2017  路  5Comments  路  Source: godotengine/godot

I think adding a node might be a better naming convention.
When you add, it is pretty obvious, that it is added as a child.
When adding a node I also always type in add_no... and than am confused why autocomplete is not proposing anything.

The main point though is: that get_node also is relative to the current node.
this is not consistent:

add_child(test_node)
get_node("test_node")

this would be consistent:

add_node(test_node)
get_node("test_node")
archived discussion core

Most helpful comment

add_child makes it clear there is a parent/child relationship. get_node can access any node in the scene tree, not only direct children.

All 5 comments

add_child makes it clear there is a parent/child relationship. get_node can access any node in the scene tree, not only direct children.

I had the same thought some time ago.
I think the add_n... happens only when you use get_nodealot and then try to add a child.
Maybe this won't happen in 3.0 anymore if the new notation $... will be used instead of get_node.

@AlexHolly oh that is a good point you bring up!

Should I close?

Yep, @neikeq summed up why the current API is fine already IMO.

Was this page helpful?
0 / 5 - 0 ratings