changing second textures

I have my human mesh with flesh texture working fine.

I have a second texture with alpha to the clothes.

And i have a third texture with alpha to the hair.

how can i change with script the clotes and the hair?

by accessing the corresponding texture slot on the material

i dont understand well what you’re telling me

I know that there is a “Main Material”, but i dont know how to refeer to “Second” or “Third” material

//C# code

public GameObject character;
public Textur2D newTexture;

void changeTex() {
    character.renderer.material.SetTexture("_BumpMap", newTexture);
}
  • charGameObject should hold your character (the GameObject with the SkinnedMeshRenderer Component)

  • replace “_BumpMap” with the texture name, you want to change (have a look into the shader, not the name in the Inspector)

Base (RGB) → _MainTex
Bumpmap (RGB) → _BumpMap