Function SetAttachEndTo not working for a spawned ACableActor

Just spawned a Cable Actor and attached it to an acctor socket, in this case is a harpoon , this part works well for the first side of the cable




FActorSpawnParameters SpawnInfo;

CableActorRef = GetWorld()->SpawnActor<ACableActor>(meshComponent->GetSocketLocation("CuerdaSocket"), (GetActorForwardVector() * -1).Rotation(), SpawnInfo);

CableActorRef->AttachToActor(this, FAttachmentTransformRules::KeepWorldTransform, FName("CuerdaSocket"));



then I am using a function to stablish the other side of the cable, and does not matter how I try (other actors, with or without socktets, etc…), It doesn’t work




void AProyectilArponClass::SetActorToSnap(AActor *target, FName socketname) {

    CableActorRef->CableComponent->SetAttachEndTo(target, target->GetRootComponent()->GetDefaultSceneRootVariableName(), socketname);

}



I am using Unreal 4.21.2, Thank you in advance for any help

I solved this problem, the…
target->GetRootComponent()->GetDefaultSceneRootVariableName() … was not working, I had to set specificly the name of the mesh component name but now I have another problem, the cable is attaching to the actor and component but not the socket… any idea? I tried to do the same but does not work "

Hello Daniel,
I do not know how to fix the socket name but how did you type out your Mesh Component Name