I’m having an interesting issue with my networked game.
I have a function that is broadcast which swaps out the mesh on a character. For some reason, in certain cases, only the client gets updated materials with the new mesh while the server uses the old materials. I’ve narrowed it out down to a few different cases that have differing results.
If the skeletal mesh has a different base skeleton, both the client and server seem to update to the correct materials.
If the skeletal mesh has the same base skeleton, only the client updates the materials.
If I try to swap out a static mesh, the server always has the original materials, while the client always gets the updated and correct materials.
I’ve tried doing this in both Blueprint and C++ and I get the same result. Any help would be greatly appreciated.
Of course as soon as I post the question I find a workaround - which is to manually force a material override on the server. For anyone that hits the problem:
skeletalMesh->SetSkeletalMesh(mUpgradedSkeletalMesh);
for (int32 index = 0; index < mUpgradedSkeletalMesh->Materials.Num(); ++index) {
FSkeletalMaterial skeletalMaterial = mUpgradedSkeletalMesh->Materials[index];
skeletalMesh->SetMaterial(index, skeletalMaterial.MaterialInterface);
}
Still not sure what the underlying cause is, as I haven’t been able to dive quite that deep in the engine. Could it be from some sort of server optimization that skips updating materials (headless server doesn’t care about visuals) except in instances where it’s swapping out the entire skeleton?