Why are the child components not destroyed?

Hi! I can’t find the answer. Please help.

I’ve created a Blueprint Actor and added two StaticMeshComponents to it (StaticMesh1 and StaticMesh2).
Placed (Attached) StaticMesh2 inside StaticMesh1.

Now I’m destroying StaticMesh1 (DestroyComponent).

Why is the child component of StaticMesh2 not destroyed?
I can do it in code, but why doesn’t it happen automatically?

1 Like

It’s just not part of the deal :slight_smile:

1 Like

I’m sorry, I don’t understand :smile:

Does this not work in UE or is it a bug?
Should I delete it manually?

1 Like

Just because they’re attached, doesn’t mean everything gets destroyed.

It it did happen, there would be others on here asking ‘why do all my attached components disappear when I destroy one of them?’ :smiley:

1 Like

It seemed logical to me to destroy child components :grin:

Also, I’ve tried these options.
DestroyComponent(true);

It seemed to work in the other post. But for me, it doesn’t even delete the parent.
OnComponentDestroyed(true);

Maybe there is a function or flag to force removal of child components?

I’ve tried to catch the component’s destroy event, but there isn’t even one of those. So that the child component destroys itself.

1 Like

I’d be the 1st to rant. It’s called Destroy Component for a reason. Not Destroy Component and Everything That is Attached to It. That’d be chaos :exploding_head: You’d undo the entire Unreal Engine :face_holding_back_tears:

This must be called either by the component itself or the actor that owns it.

It’s this:

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.