I have a tree somewhat like this:
Root (script here)
- lots
- of
- other
- nodes
- here
- HUD
-- HBoxContainer
--- lifeIndicator
--- lifeIndicator
--- lifeIndicator
The lifeIndicator
nodes are in a group called lifeIndicators
This is the function I'm using to remove them:
func removeLifeIndicators():
var indicators = get_tree().get_nodes_in_group("lifeIndicators")
for i in indicators:
if i != null:
i.queue_free()
The good news is, it removes them. The bad news is it removes EVERYTHING so that all that's left is the Root node. Everything else is gone.
How can that possibly be? It must be something simple but I just can't see it.