Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | burstina |
hello,
I’m not yet very good at understanding queue_free().
I know that calling node.queue_free()
put that node in queue for being deleted, but what happen to its children? I thought they also would be freed before that parent node, but my experience taught me it doesn’t happen, or it doesn’t happen this way.
My project started to crash after doing something I’m not here for. I found the solution when I deleted a specific kind of node
code speaking, this script made application to crash:
onready var node_ref = weakref($ParentToDelete)
get_node("ParentToDelete").queue_free()
if node_ref.get_ref() == null:
get_tree().change_scene(some_new_scene)
changing as following, application crashes no more:
#-- changed
onready var node_ref = weakref(get_node("ParentToDelete\child"))
# -- the same than before
get_node("ParentToDelete").queue_free()
if node_ref.get_ref() == null:
get_tree().change_scene(some_new_scene)
So, my question is: how 'queue_free()` works on children when called on parent node?
thanks
Graziano