I have a smoke trail GPU2DParticles effect attached to a rocket. If the rocket explodes and is removed from the tree, I'd like the effect to be reparented to another node (root in the example), so that the trail remains and does not immediately disappear with the rocket.
I used to do this explicitly (reparent on collision -> explosion), but I am wondering if this could be done on e.g. tree_exiting or another signal or method call on a script on the effect itself.
func _ready() -> void:
func trigger_reparent() -> void:
# Silently does not work.
# Error: trigger_reparent: Parent node is busy setting up children.
func reparent() -> void:
var gp = global_position
self.global_position = gp
If I immediately try to reparent in tree_exiting, I get the cryptic "Parent node is busy setting up children." (I assume the parent node state is just not ok for removing children between
What is the best way to reparent e.g. effects on parent death? Thanks!