Can't correctly change material after changing skeletal mesh

I’m trying to use BP to dynamically change a character’s skeletal mesh, and then depending on some factors, some materials on that new mesh. I can correctly change the skeletal mesh with Set Skeletal Mesh on the character’s Mesh, and if I do only this the mesh is correctly changed with the default materials of the new mesh.

However, if I add a Set Material by Name or Set Material block, the character gets grey parts where the new materials should be. This does not happen if I try to change the materials on the default mesh with the same process, so it might be that the materials are at fault. But the different materials are really only copies of the base ones with different textures.

What could I be doing wrong?

I have the same issue, any help?

Do you have ‘Used with Skeletal Mesh’ enabled under the Usage section of the material?

Wow, I don’t think so, thank you for the hint!

Actually, both materials have these flags( My problem is a little bit different because I have a modular body with torso and head, to head attached camera and it rotates with the camera. Somehow it makes problems with material change because with the torso it works fine, need to dig into it deeper.

Old post but here in case anyone else runs into the issue. When you swap skeletal meshes it seems to in some cases use the material slots of the previous mesh.
What you need to do is get the Skeletal Mesh Object Reference of the Skeletal Mesh Component. Grab the Materials from the Skeletal Mesh Object Reference and break the data to get the Material Interface which is the original material of the mesh.

1 Like

I am facing the same issue: I am using Version 4.27.2 I am using a skeletal mesh for the hair and I want to be able to dynamically use different hair colors in the game. I also want to use different hair styles (= different skeletal meshes) eventually, but first things first:

  • I tried to create dynamic material instances, assign them to the skeletal mesh of the hair and change the texture files for these dynamic material instances. Although I saw that the dynamic material has been assigned to the skeletal mesh component of the character and I used a print command to check what Texture file was assigned to that dynamic material, the end result was the same: the skeletal mesh is displayed dark grey as if the engine didn’t know how to render it at all.
  • I also tried to just change the skeletal mesh of the skeletal mesh component with the version that would be reflect the chosen color. Same result. When test playing the game, the correct skeletal mesh is assigned to the skeletal mesh component and the correct material is assigned to the corresponding skeletal mesh, but it would still not render.

The materials as set for “use in skeletal mesh” and I tried it using Texture Streaming and without using it. I am sincerely lost. Any ideas? Thank you!

I had a similar issue. Running this code worked for me. Essentially it gets the actual skeletal mesh materials and resets them to themselves before applying new materials to specific slots.


Interesting. Thanks for that. I will try it out!

Also try this variant


This does the trick. Thank you :slight_smile: