ChildActorComponent leaving garbage everywhere
I've got a weapon component system that uses several UChildActorComponent in my weapon blueprint. The issue is when the weapon blueprint is changed in the editor it absolutely trashes my level.
The Actors created by the ChildActorComponents lose their association instead of being deleted before new ones are created by the ChildActorComponents... I end up with a correct copy of my weapon actor with it's actors I can move around, but where it used to be are the unassociated Actors that appear to be spawned for the ChildActorComponents.
I am Casting ChildActorComponent's->ChildActor to a different type of that helps any, I know there used to be an issue with this but it was fixed versions ago I thought.
After some experimentation it seems that ONLY ChildActorComponents added via C++ do this, if you add them in a blueprint instance of the class they do not have this behavior.
In my constructor I create them like this:
then in the OnConstruct I move them around like this:
GetBarrelAttachPoint returns a vector of where the barrel should be attached, It just fetches the ComponentLocation of a scene component. And GetCollisionBox returns the top most root component of the parent type (ABoxComponent)
I've created a "fix" for this issue, which is more of a work around than anything:
GetChildActorComponents is a custom method that returns a TArray of childActorComponents connected to the actor.
I was able to reproduce the problem. It seems like it may be related to attaching the child component to a component and then trying to set the location elsewhere in the OnConstruct function. I wouldn't say that this is proper workflow but leaving behind non-referenced instances is a problem so I've reported the issue. For reference, the bug's number is UE-26773. I'll be sure to let you know of any updates made to it.
answered Feb 10 '16 at 08:10 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here