Hey there, I have a bunch of child actor components that are spawned in C++ from the construction script. My code is as follows:
.h
UPROPERTY( Transient ) TArray< UChildActorComponent > SpawnedChildObstacles;
.cpp
UChildActorComponent* NewComponent = NewObject< UChildActorComponent >( this );
if( NewComponent )
{
NewComponent->SetChildActorClass( Class );
NewComponent->AttachTo( RootComponent );
NewComponent->RegisterComponent();
NewComponent->bCreatedByConstructionScript_DEPRECATED = true;
SpawnedChildObstacles.Add( NewComponent );
}
I clear my vector when I spawn the new UChildActorComponents. For some reason when I move the parent object around (causing my construction script to be called) it does not remove the previous UChildActorComponents.
The strange thing is that if I close the parent blueprint and reopen it, the old ones are removed and everything is fine!