print("Before Removal")
print($dice_pane.get_children())
for d in $dice_pane.get_children():
#if !dice_keep.has(d.name):
print("Removing a Dice" + str(d.name))
# Disconnect from signals
#d.disconnect("remove_dice_from_keep", self, "remove_dice_from_keep")
#d.disconnect("add_dice_to_keep", self, "add_dice_to_keep")
# Remove the dice node
d.queue_free()
print("After Removal")
print($dice_pane.get_children())
Output:
Before Removal
[[Control:1901], [Control:1911], [Control:1917], [Control:1923], [Control:1929]]
Removing a Dice :: dice
Removing a Dice :: @dice@2
Removing a Dice :: @dice@3
Removing a Dice :: @dice@4
Removing a Dice :: @dice@5
After Removal
[[Control:1901], [Control:1911], [Control:1917], [Control:1923], [Control:1929]]
What is even weirder is that the nodes physically leave my 2d scene. So I'm guessing what is happening is that in the time it takes to reach the bottom of my removal script, the nodes haven't been deleted yet. How can I correct this? I do some other operations at the end of the button press function that calculates a score and such and it's including the dice nodes that are supposed to be deleted.