Destroy Actor without destroying its Child Actors?


I have an actor which has a couple of Child Actors, and I would like to destroy this Parent Actor but not the Child Actors, i.e. keep the Child Actors alive as individual Actors.

I thought that maybe I have to detach the Child Actors with the “DetachFromActor” function, but this doesn’t seem to work (or I am applying the function wrong), because
the children still get destroyed when I destroy the parent actor.

Any hints, please?

Hi there,

Child Actors are specifically for that, to be managed by the parent actor (created / destroyed).
You probably want non child actors if you need them to persist if parent is destroyed, just attach them manually yourself.

Ok, I had a misconception of Child Actors then, this cleared it up, thank you very much.

Just a thought: change collision / visibility on the parent, re-enable both on children?
(Inheritance may be a barrier for Visibility especially, can’t recall if you can override).

Thanks for the suggestion. The problem is that I need to destroy the parent, because there are continuously spawned new instances of it.
And the attached Actors (former Child Actors) just have a different lifecycle independently of each other and the parent, but at first share the parents transform for some time.

I tried to execute neo’s solution, and the first part of attaching the Actors to the parent works, but if I then destroy the parent the Actors still get destroyed.
I attach them with “AttachToActor” and try to detach them with “DetachFromActor” before the parent gets destroyed. My current suspicion is that I use the “DetachFromActor” incorrectly.

Understand… My feeing is that the above should definitely work.
How can Destroy affect the Detached actor, that is very strange.
Unless you have some parent / child or other relationship intact???

Alright it seems to work now, strangely enough only when I DON’T detach the actors.

At first I thought the problem was attaching them in the construction script of the parent, passing them as array, so the reference could be trouble. I changed that doing the attaching from outside the parent, but only after removing the detaching logic they stayed alive…

Anyways, thanks again for all your input.