Hi,
I’m sure that the solution is very easy but I can’t find it…
I have a class inherited from ACharacter and I want to attach two sphere components to sockets. I initialize the components in constructor and attach them in PostInitializeComponents function
void AEnemyShooter::PostInitializeComponents()
{
Super::PostInitializeComponents();
if (LeftHandSocket != NAME_None && GetMesh())
{
LeftHandCollisionComp->AttachTo(GetMesh(), LeftHandSocket);
}
...
...
But in the line where the component is going to be attached the game crashes (editor and code either). The error come from USceneComponent class:
void USceneComponent::AttachTo(class USceneComponent* Parent, FName InSocketName, EAttachLocation::Type AttachType /*= EAttachLocation::KeepRelativeOffset */, bool bWeldSimulatedBodies /*= false*/)
{
if(Parent != NULL)
{
**if (Parent == AttachParent && InSocketName == AttachSocketName && Parent->AttachChildren.Contains(this))**
...
Any idea what is the mistake??
Thanks