Changing materialss

Hello, im using a code to change the material when the model is swapped, sadly my new model has 2 materials, and i cant figure out how to change 2 materials at once. how can i accomplish that?.
this is the code im using so far

if(MaiaBody == 1)
        {
            character.sharedMesh = MaiaBody001;
            character.sharedMaterial = Maia001Skin;
        }else

I need to add another material, Maia001bSkin, but i cant figure out how to enable the slot to set it.

Instead of material', the mesh will have a materials’ array which you can change. You’ll need to get a handle on the array, set the members, then reassign the mesh again. Something like this:

var materials = character.materials;
materials[0] = mat1;
materials[1] = mat2;
character.materials = materials;
1 Like

Thanks man, worked like a charm!!!