Let say you have a character object that have 5 material on it, below is how you can change all the 5 material color using script
1. Create a new javascript
2. Paste in below code
var mySkinnedMeshRenderer: SkinnedMeshRenderer;
var texture1: Texture;
function Start () {
mySkinnedMeshRenderer.materials[0].mainTexture=texture1;
mySkinnedMeshRenderer.materials[1].mainTexture=texture1;
mySkinnedMeshRenderer.materials[2].mainTexture=texture1;
mySkinnedMeshRenderer.materials[3].mainTexture=texture1;
mySkinnedMeshRenderer.materials[4].mainTexture=texture1;
}
3. Drag your code into your Character object
4. Click your Character object, you should see the script property have 2 variable, Drag anyone of the texture into variable texture1
5. Drag Your character object into variable mySkinnedMeshRenderer
Now if your character have 5 different part of Material you will see all of them turn into texture1
Hope this help
Do you know how to change the shader in Skinned Mesh Renderer?
ReplyDelete