+1 vote

So I have the basic code that removes all children from a node:

    for child in get_node("PanelCarry").get_children():
        child.queue_free()

Normally this works just fine for me how every now it is not removing any of the children. Behind the scenes the children I am trying to queue free are instanced in by code however this has never been a problem for me. As for any other crazy things going on there is none that should ever effect this. Thank you for any answers

in Engine by (63 points)

1 Answer

0 votes

Is child getting any nodes from get_node("PanelCarry").get_children()?
A print(child) might help to see that. If you get nulls there's nothing there to free.

by (111 points)

yeah it even prints exactly what I want it to free but for some reason it just does not free it.

And still for testing, have you tried just "free()"?
The worst it can happen is to crash the program, but at least you see that there is something happening.

yeah it crashes my program. To give you more information, I tried printing the child count before and after the code was ran and the number stayed the same.

So the problem may not be the queue_free but something that doesn't release the nodes. But for that I have no ideas.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.