private static colorRecursive ( Transform transform, Color toColor, bool useRecursion = true ) : void | ||
transform | Transform | |
toColor | Color | |
useRecursion | bool | |
return | void |
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);
}
}
}
LTDescr::colorRecursive ( |