Hello guys , I have a problem to change a material of childrens of my father game object , my script find correctly the childrens that i want to change material, but don’t work anything and materials don’t change.
Here’s the script
public void ChangeBody(GameObject Vittim)
{
Transform tr2 = Vittim.transform.GetChild(3);
Transform tr3 = tr2.GetChild(1);
Transform tr4 = tr2.GetChild(2);
Transform tr5 = tr2.GetChild(3);
Debug.Log(tr3.name);
Debug.Log(tr4.name);
Debug.Log(tr5.name);
tr3.gameObject.renderer.material = MatBody**;**
__ tr4.gameObject.renderer.material = MatBody**;__
__ tr5.gameObject.renderer.material = MatBody;**__
** }**
the game object that i want change the material at level editor is this
[29440-imm1.jpg|29440]
i use the unity version 4.3.2f1