How to change static/skeletal mesh component together with its own material, rather than re-assigning materials?

Hi guys, I’m writing an NPC blueprint which assigns skeletal mesh assets to different part of a skeletal mesh hirerachy


The blueprint has a enum of different names of character, and a variable of structure of different parts (body, torso, legs, feet, face) of skeletal meshes.
When level designers select a character’s name from the NPC blueprint actor in the level, the construction script reads the map of structure variable and assign different assets to different skeletal mesh component.

However, I found that only one or two material change according to the skeletal mesh component change.
For example, if I switch from character A to charcter B, the construction script will set B’s head. But it for most of the time will continue to use the face materials of character A’s face. The hair assignment is always faulty, the hair material never changes according to the hair asset change, I have to change the hair material manually.

How do I solve that? Metahuman’s face consists of a lot of material slots, manually script their assign material nodes one after one in construction script is a nightmare.

Hello, I have the same question, and I find a solution that may not be very good.

I destroy the mesh component and create a new one attach it’s parent.

that good for me, hope it’s useful.

Hi, we had similar issue some time ago. If I remember correctly what helped for us was to clear skeletal mesh before setting new one, so materials are firstly reset and then new mesh has it’s own materials correctly.

Something like this:

If it doesn’t help, I will check the code in the afternoon and see what exactly fixed this.

EDIT: ok now I checked the date of the initial post xd