Hello Unreal Community,
I’m encountering a recurring issue with my Unreal Engine project where virtual bones in my skeletal mesh are not being recognized intermittently. This problem started unexpectedly yesterday, even though I was working on a completely unrelated feature. I primarily use a virtual bone to attach my camera.
Problem Description:
While everything was functioning correctly before, the virtual bones now seem to sporadically fail to be recognized. For instance, when I use the GetAllSocketNames()
function, it does not list any of the virtual bone sockets. However, if I manually rename the virtual bone in the skeleton editor and then play, it recognizes the bone but the camera attached to it exhibits a strange shaking behavior.
Steps to Reproduce:
- Start the game.
- Virtual bones are not recognized (no listing with
GetAllSocketNames()
). - Rename virtual bone to the same name in the skeleton editor.
- Play the game - the virtual bone works but the camera shakes.
Code Snippet:
void ACharPlayerBaseCharacter::BeginPlay()
{
Super::BeginPlay();
const FCharBaseData CharData = CharacterDataAsset->Character1PData;
ArmsMesh1P->SetSkeletalMesh(CharData.SkeletalMesh);
if (ArmsMesh1P && ArmsMesh1P->GetSkinnedAsset())
{
const FName SocketCameraFPSAnimated = FName("VB head_root");
TArray<FName> SocketNames = ArmsMesh1P->GetAllSocketNames();
if (ArmsMesh1P->DoesSocketExist(SocketCameraFPSAnimated))
{
SceneCamera1P->AttachToComponent(ArmsMesh1P, FAttachmentTransformRules::SnapToTargetNotIncludingScale, SocketCameraFPSAnimated);
}
}
}
Additional Context:
- The issue started without any recent changes to related code or assets.
- Restarting the IDE and rebuilding the project temporarily fixed the problem the first time, but after some minutes it stopped again.
Any insights or suggestions on what might be causing this issue or how to resolve it would be greatly appreciated. Thank you in advance for your help!