I have a blueprint that is an actor composed of child actors. My problem is that I need to detach child actors in runtime, and I have used DetachFromComponent but it does not work.
Hi Chevidal451,
That’s for components - use DetachFromActor() - call it from the child actor, it takes a parameter of type FDetachmentTransformRules to tell the actor how to be located in the level:
It works but I don’t know why it doesn’t drag the children, i.e. the child actor who unattaches, unattaches alone (no children), the children of that child actor don’t leave with him. Any idea how to deal with this?
How are you creating those child actors? Can you show us your code?
I create them in the blueprint, I only used C++ to create an inherited class form UChildActorComponent and adding some values. For example in this case, when I unattach child actor 2, its child does not leave this super actor.
I see now, you’re creating ChildActorComponents. Two ways I can think of - the first would be to just spawn normal actors and attach them to your parent actor - they attach to the Root Component - that’s what I thought you were doing.
To detach a ChildActor - you could spawn a new actor using the child actor as the template, then destroy the ChildActorComponent.
Sorry for answering so late, my problem is that I want to set the super actor from the editor with the viewport. So I think I’m going to have to go for your second solution, make the spawn of an actor with the structure of that child actor with its corresponding child actors.