Runtime deleting components crash because of names

Hello everyone,

I’m right now developing an actor class that, when spawned in the editor creates a bunch of components name “Component_X” attached to itself, being X its index. The property that indicates how many of these components are to be created can be changed in the editor using the UPROPERTY stuff.

When the number is changed to a lower one, the components are deleted using:


This works fine, the components disappear both in the screen and in the actor’s details.

Problem comes when the number is changed to a higher one BEFORE it was changed to a lower one. Unreal Editor crashes and I’m pretty sure it’s because of the names. I debugged this: I change the number to a lower one (and thus, destroy some of the components), then if I try to manually create through the editor a component with the name “Component_X”, being X the number of a component that existed before deleting, it says that there’s already a component with that name.

That makes me think that something is not working during the destruction. Is it a garbage collector trouble?