I would imagine you’d have to remove_child before you queue_free. Also, check where the error is happening, because you may be accessing that node after it’s gone.
I added the remove_child call, but the error is still being printed, along with two new ones. I’m also pretty sure that the node is not being used afterwards.
var del_block:CyclopsBlock = builder.get_node(block_path)
del_block.get_parent().remove_child(del_block)
del_block.queue_free()
Can't take value from empty array.
scene/main/node.cpp:1409 - Parameter "p_child" is null.
scene/main/node.cpp:1437 - Condition "p_child->data.parent != this" is true.
Deleting the block seems to work fine. I do not think the errors are related to that gdscript.
I think the error is something to do with the block one selects (to delete) being somehow remembered.
Click block 105 (cyclops_blocks node)
Delete it
Click on any other block and you will see the Can't take value from empty array. error.
Click on block 19 (easy cos it’s at end)
Click around a bit and watch for that error. At some point it stops printing.
Conclusion : There is some situation with the last deleted block (and an array of blocks) that is happening when the node tree gets touched: i.e. when nodes are selected, added, removed.
I would look into your input handling code for get_parent/get_sibling calls which assume the old block is still there.
If you don’t get closer to the bug now, let me know. I have to get to my own code now!
Thanks. These kind of errors have been really hard to track down. I’ve been able to ignore them so far because they don’t seem to be causing any problems, but you never know.