Using GameObject.Find() or something, can I can get to the Skinned Mesh Renderer component in my primary characters hierarchy, but once I am there, how do I access the Material property?
GameObject.Find("Bip01_Pelvis").material.renderer.shader = Shader.Find("..");
//Find the *second* material on the Bip01_Pelvis object/bone.
//attached to the players parent
void Update()
{
if (FadeSkinnedMesh) //set true in gui
{
if (GameObject.Find("Bip01_Pelvis").renderer.material.shader == Shader.Find("Bumped Diffuse"))
{
Debug.Log("Found shader! Now reassign to a different one..");
GameObject.Find("Bip01_Pelvis").renderer.material.shader = Shader.Find("Transparent/Cutout/VertexLit"));
}
else
Debug.Log("Could not find shader :(");
}
}
void OnGUI()
{
if (Input.GetKeyDown(KeyCode.LeftControl) FadeSkinnedMesh = true;
}
Oh geez, sorry that was a typo on my part. I had it correct all along, but it still doesn't work..
– anon99153346well i did all the changes but nothing worked... is there another solution?
– kaisersam