when you try to delete a child node and add a new node, the node just disappears

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By BOX_Milk

i made a simple project
which i need to drop
here is the code i tried:
var remove = $inventory.get_child(hand)
but the node just disappears
and don’t know why
please helps

that code should work I think you could try and use

call_deferred('add_child', remove)

but If what you’re doing is changing the parent of the node you can use this instead


also small tip instead of doing get_parent().add_child() you can do add_sibling() which does the same thing but easier to read

OgGhostJelly | 2023-03-02 15:31