Hello,
I use the SetSkeletalMesh for set the mesh of my character.
The function work, but after a lot of time when the function is call, it’s crash randomely in the function SetSkeletalMesh but because of the index of bones like GetboneName(int32 index).
I call the function when my player is hit by my enemy.
The variable SkinsCharacter is all the SkeletalMesh who are going to be use by the character.
Example:
When the player have an helmet, I must not display the hair of the player to avoid texture bug. But when the player loose his helmet I must display his hair.
So I create multiple Skeletal Mesh and set them when I need it to avoid this probleme. SkinsCharacter is create with some FSkeletalMeshMerge.
bool UArmorManagerComponent::LosesArmor(USkeletalMeshComponent* mesh, TArray<USkeletalMesh*> SkinsCharacter)
{
if (CurrentNbArmor > 0)
{
CurrentNbArmor--;
if (CurrentNbArmor < SkinsCharacter.Num())
{
if (SkinsCharacter[CurrentNbArmor] != nullptr)
{
mesh->SetSkeletalMesh(SkinsCharacter[CurrentNbArmor], false);
}
}
return true;
}
else
return false;
}