# C++ GetAllSocketNames returns bones along with sockets

**URL:** <https://forums.unrealengine.com/t/c-getallsocketnames-returns-bones-along-with-sockets/409828>\
**Category:** Character & Animation\
**Tags:** sockets, skeletalmeshcomponen, unreal-engine, CPP, question\
**Created:** [November 16, 2017, 8:56pm UTC](https://forums.unrealengine.com/t/c-getallsocketnames-returns-bones-along-with-sockets/409828 "2017-11-16T20:56:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_7fb70ffd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_7fb70ffd](https://forums.unrealengine.com/u/anonymous_user_7fb70ffd)\
**Post date:** [November 16, 2017, 8:56pm UTC](https://forums.unrealengine.com/t/c-getallsocketnames-returns-bones-along-with-sockets/409828/1 "2017-11-16T20:56:41Z")

</div>

I’m currently working with a standard mannequin supplied along with UE4. I added a socket to one of its bones. When I try to get an array of all sockets in this skeletal mesh, it also returns a whole bunch of other bone names along with my manually created socket name:

```
TArray<FName> SocketNames = SkeletalMesh->GetAllSocketNames();

```

However it supposed to only return sockets, according to its name, and that’s what I actually need.  
Any help is appreciated.

---

<div class="post-metadata">

**Author:** ![Firefly74](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Firefly74](https://forums.unrealengine.com/u/Firefly74)\
**Post date:** [November 16, 2017, 10:46pm UTC](https://forums.unrealengine.com/t/c-getallsocketnames-returns-bones-along-with-sockets/409828/2 "2017-11-16T22:46:20Z")

</div>

Hi again !

Indeed, this get all socket + bones ! ( Naming once again … )

to only get sockets you can use this code :

```
	USkeletalMeshComponent* mySkeletalMeshComponent; 

	const TArray<USkeletalMeshSocket*> AllSockets = mySkeletalMeshComponent->SkeletalMesh->GetActiveSocketList();

	for (int32 SocketIdx = 0; SocketIdx < AllSockets.Num(); ++SocketIdx)
	{
		FName name = AllSockets[SocketIdx]->SocketName;
	}

```

Have a good day !

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_7fb70ffd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_7fb70ffd](https://forums.unrealengine.com/u/anonymous_user_7fb70ffd)\
**Post date:** [November 16, 2017, 11:46pm UTC](https://forums.unrealengine.com/t/c-getallsocketnames-returns-bones-along-with-sockets/409828/3 "2017-11-16T23:46:08Z")

</div>

Good day, sir 🙂  
I actually came across another answer before posting my own, where the dude also suggested to use “SkeletalMesh-\>GetActiveSocketList();”, but from his answer it wasn’t obvious that SkeletalMesh != SkeletalMeshComponent, and is actually inside of SkeletalMeshComponent. Plus his reply was very outdated, so I couldn’t fine that GetActiveSocketList() function in SkeletalMeshComponent API, thus I thought it is deprecated and has been removed. (Making excuses :))  
Anyway, you saved me lots of time sir, I salute you!  
Have a great day!  
ps. Epic really should fix their docs and naming :s

---

<div class="post-metadata">

**Author:** ![Rouzzy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rouzzy](https://forums.unrealengine.com/u/Rouzzy)\
**Post date:** [February 4, 2019, 6:09pm UTC](https://forums.unrealengine.com/t/c-getallsocketnames-returns-bones-along-with-sockets/409828/4 "2019-02-04T18:09:05Z")

</div>

Hello.  
I tired to use this function in my custom player controller in BeginPlay. and i get a list of 0 sockets / bones. Does it have to be used in a different function? or what’s going on here…  
PS: i’m trying to get all the bones on game load so i can manipulate them later.

---

<div class="post-metadata">

**Author:** ![Rouzzy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rouzzy](https://forums.unrealengine.com/u/Rouzzy)\
**Post date:** [February 4, 2019, 6:42pm UTC](https://forums.unrealengine.com/t/c-getallsocketnames-returns-bones-along-with-sockets/409828/5 "2019-02-04T18:42:03Z")

</div>

Nevermind. Figured it out. I needed to use GetBoneNames(BoneNames) on my USkeletalMeshComponent now i have all bone names.
