I have add several materials to the Skinned Mesh Renderer Node of an animated FBX file.
But I can't seem to switch the materials. Keep running into this error among others:
An instance of type 'UnityEngine.Renderer' is required to access non static member
I have a simple Java Script attached to the same node with:
renderer.materials = SkinnedMeshRenderer.materials[skinChoice];
I've also tried using shared.materials
What is the proper method to change textures and materials on animated fbx files?
system
2
//#1
var Material1 : Material;
var Texture1 : Texture;
//#2
var Material2 : Material;
var Texture2 : Texture;
function update(){
if()
{
GameObject.Find("object").renderer.sharedMaterial = Material1;
GameObject.Find("object").renderer.material.mainTexture = Texture1;
}
else
GameObject.Find("object").renderer.sharedMaterial = Material2;
GameObject.Find("object").renderer.material.mainTexture = Texture2;
}
This should work, if this is what you wanted to do?
Change the material and texture of an object?