Question by
ewoudwerf · Mar 22, 2016 at 08:56 PM ·
c#materialskinnedmeshrenderer
swapping materials on SkinnedMeshRenderer
I want to swap specific materials on play, i tried this but it doesn't work:
if (CrossPlatformInputManager.GetButtonDown("StartGame"))
{
if (GetComponent<PlayerTeamSorting>().IsBlue == true)
{
GetComponentInChildren<SkinnedMeshRenderer> ().materials [2] = BlueArmyMat;
}
if (GetComponent<PlayerTeamSorting>().IsRed == true)
{
GetComponentInChildren<SkinnedMeshRenderer> ().materials [2] = RedArmyMat;
}
}
Comment
Your answer
Follow this Question
Related Questions
Skinned mesh renderer deforming objects. 0 Answers
How can I remove Ambient Occlusion from Transparent Cutout? 1 Answer
Renderer.materials not working in void update() 2 Answers
Is there any way to make a gradient within unity?,Is there any way to make a gradient? 1 Answer
Highlighting Multiple Objects with an Outline Shader 0 Answers