Attach Actor to socket via C++

Ok Im trying to trouble shoot segments of this code, I found that Im not getting the correct name from my mesh. In the code im checking for the name of a USkeletalMeshComponent:



 if (playerMesh->GetName() == ComponentName)


The GetName() should be returning “HeroTPP”, but instead it is returning “CharacterMesh0”. So I change the code to check for “CharacterMesh0” and then the MyWeapon class sucessfully attached to the Character.

The weapon mesh spawns pointing straight down, relative to the character, Im not sure how to get it pointed in the correct direction.
EDIT I was able to do a local rotate in the editor of the weapon socket, now its pointing in the correct direction.

How can I check for the real name instead, which is “HeroTPP”? I tried to use GetReadableName() name and that gave me something closer; it returned “MyCharacter_C_12.CharacterMesh0 HeroTPP”.