Godot: Allow null in add_child_below_node

Created on 17 May 2019  路  3Comments  路  Source: godotengine/godot

Godot version:
3.1.1

Issue description:
There's this method called add_child_below_node(), which allows to add child below a specific node. But I just needed to add a child on top, i.e. as first child. It doesn't seem to be possible right now (although add_child -> raise is a workaround EDIT: Actually not, and the description is misleading :/ ).

Maybe it would be useful if add_child_below_node() allowed to take null for node parameter, which would make the node a first child.

archived enhancement core gdscript

Most helpful comment

Even better would be to add an add_child_at(Node node, int position) function.

All 3 comments

If you want to make a node first child, you can use parent.move_child(child, 0). add_child_below_node() is barely a shortcut calling it (https://github.com/godotengine/godot/blob/master/scene/main/node.cpp#L1191)

Even better would be to add an add_child_at(Node node, int position) function.

Sooo looks like add_child_below_node was removed in #38695, which means that this needs a new method now. That's not really worth it anymore .-.

Was this page helpful?
0 / 5 - 0 ratings