Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Godotmus |
I have bit of confusion what is the right way to handle instantiated node removal from array so no memory leaks or to much garbage collection would occur.
# this feels wrong??
my_node_array[5] = null
# how about this, to temp variable or straight from array?
my_node = my_node_array[5]
# 1. way ?
get_parent().remove_child(my_node)
# 2. way or both??
my_node.queue_free()
# finally.. needed or not??
my_node_array[5] = null
#check to get state of array element ????
if my_node_array[5].is_instance_valid(): vs. if my_node_array[5] == null: