Godot Version
4.3 Stable
Question
Hello! I’m making a script where I create instances and after a button is pressed a certain amount of times, it’s deleted. I’m using a for loop to increase the amount until it’s deleted, and when it gets to the amount where it deletes, it successfully gets freed. The problem is when I try to increase the amount after that. I think queue_free() doesn’t fully delete the node…
Here’s my code
for i in range(len(sequence)): #repeates until it reaches the number of instances
var p = $".".get_child(i+1) #the parent node of the instances is calling the next instance
###this is calling the expiration for the instance
#this isn't where the problem is, so don't worry too much
var food = p.get_child(0).text
var expiration = new_item[food + str(base)]
expiration = int(expiration)
###
Callable(p,"_change_expiration").call(expiration,cur_day)
#calls the function within specified instance
func _change_expiration(expiration,cur_day):
###not too important, it's setting a label within the instance
#this is not where the problem occurs
var p = self.get_child(1).text
p = expiration-cur_day
self.get_child(1).text = str(p)
###
if p == 0: #this is where the problem starts
self.get_parent().remove_child(self)
#the instance is removing itself, which is working fine
#the problem is when
##var food = p.get_child(0).text##
# is called, it tries to call a null node
TL;DR, I think queue_free() doesn’t delete a node, but makes it instead. Is there another way to delete a node permanently?