Can someone please explain to me why I have to use a text literal to attach a component to a skeletal mesh socket?
I am attaching a UChildActorComponent to an ACharacter mesh USkeletalMeshComponent using the following code:
WeaponComponent = CreateDefaultSubobject(TEXT(“WeaponChildActor”));
if (WeaponComponent != nullptr)
{
WeaponComponent->bEditableWhenInherited = true;
WeaponComponent->SetupAttachment(GetMesh(), FName(“Socket_Weapon”));
}
Originally I had planned on using a UPROPERTY FName to store a socket name and use allowing artists to use whatever socket name they desired. For whatever reason this does not work. Regardless of how I attempt to attach the component, AttachTo (deprecated), AttachToComponent, or SetupAttachment, The name is ignored for attachment purposes. Although if I use a text literal to create an FName in place, as the above code shows, then attachment works correctly.
As I have a solution I am just completely curious as to why this is even an issue. Hopefully someone from Unreal or someone with knowledge of how this system works can shed some light on what appears to be a completely baffling design issue.