Hey guys,
I have an issue where I try to create Default subcomponents in the Constructor of a custom component:
For Example:
UCustomComponent::UCustomComponent()
{
BoxCollision = CreateDefaultSubobject<UBoxComponent>(TEXT("BoxCollision"));
BoxCollision->AttachTo(this);
BoxCollision->RegisterComponent();
}
Almost everything works fine. The box collision is spawned and attached to the UCustomComponent (BaseClass is Scenecomponent)
but the Problem is that when I have multiple UCustomComponents in an Actor the References of the components collide and some Components have references to members of others.
It’s a really weird issue and I’m very frustrated because I spent so much time Setting everything up.
I looked through the Engine source code and could not find anything which helps me.
There has to be a way to get this to work.
Thanks in advance for you help