Hi all !
I’m facing a very disturbing issue in the builds of our multiplayer game :
we have a class base on Character that contains a few components, including a third person mesh component (the game is first person, so this is used to show the player where it is not locally controlled)
In the constructor this mesh component has no skeletal mesh set, and no animation class set.
The meshes are stored in an array so we can choose which one we apply
from ACharacterBase.h :
UPROPERTY(EditAnywhere)
TArray<USkeletalMesh*> ThirdPersonMeshes;
At run time, I then set the mesh and the animation class :
void ACharacterBase::LoadSkin() {
uint8 SkinId = GetPlayerState()->SkinId;
check(ThirdPersonMeshes.Num() >= SkinId);
USkeletalMeshComponent* ThirdPersonMesh = GetMesh();
check(ThirdPersonMesh);
ThirdPersonMesh->SetSkeletalMesh(ThirdPersonMeshes[SkinId - 1]);
ThirdPersonAnimClass = ThirdPersonAnimationClass[SkinId - 1];
// actually we use a short timer to make sure the mesh has been set properly otherwise we get a few warnings
// but i didn't want to add unneeded details
GetMesh()->SetAnimInstanceClass(ThirdPersonAnimClass);
}
We do this only once after some initialization, and we never change it afterwards.
In PIE this works fine, but when I cook my content, virtual bones don’t work anymore : instead of following the bones they’re related to, they are stuck at the origin point of the skeleton
This is not always happening, and it’s triggered by stuff totally unrelated (like adding a certain call in the level BP), but this seems very related to the fact that we set the skeletal mesh at runtime, after initialization.
I’m going to dig into the engine code, but if any of you have an idea about where this could come from, or if it is a known bug, tell me !