private static void colorRecursive( Transform transform, Color toColor, bool useRecursion = true ) { Renderer ren = transform.gameObject.GetComponent<Renderer>(); if(ren!=null){ foreach(Material mat in ren.materials){ mat.color = toColor; } } if(useRecursion && transform.childCount>0){ foreach (Transform child in transform) { colorRecursive(child, toColor); } } }