How to Attach a Mesh to Socket

Hey Community,

Quick question. What is the method for attaching a mesh object to a socket on the character?

	ConstructorHelpers::FObjectFinder<UStaticMesh> Object0(TEXT("StaticMesh'/Game/Props/SM_PillarFrame.SM_PillarFrame"));
	UStaticMesh* TestingMesh;
	TestingMesh = Object0.Object;

So far this is where i’m at. I would like to call this at BeginPlay so as soon as the character enters he/she will have a particular mesh already attached, as opposed to handling it via constructor. This way in C++ I can create conditions on whether or not it is actually there or not.


Yup, this did it. Thanks Rama-Llama, haha.

you’re sort of halfway between two options

Make the Static Mesh a sub object ptr actor component of the actor itself, and add/remove it at any time (this is how I do things, for equipping / de equipping both skeletal mesh and static mesh weapons and armor from a character very quickly

#2, more clumsy
Make a static mesh actor, spawn it at runtime, and attach it to the player using a socket name

Since I don’t recommend #2 I am not going to explain it further

for #1 see my wiki tutorial!

#Wiki Tutorial on custom Actor Components

A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums,Making_Native%26_Deferred_Attached_to_Socket