GetSocketByName() returns nullptr

Klaub
Sat, 12 May 2018 11:59:06 +0000
C++

Hi, so I have a socket on my skeletal mesh called Hand_RSocket, and I’m trying to attach a static mesh subobject to it with the following code:

  const USkeletalMeshSocket* SwordSocket = this->GetMesh()->GetSocketByName(FName("Hand_RSocket"));

MySwordComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("MY SWORD"));
MySwordComponent->SetupAttachment(RootComponent, SwordSocket->GetFName());

However, GetSocketByName returns a null pointer for some reason. Am I doing something wrong? Thanks!

1 post - 1 participant