Best way to change materials for all the applicable children in a model (parent) using a switch or button?

Trying to make a model viewer that switches from its normal material then to a gray (default-material) style. The model can’t be directly changed but has different parts (children) that can. How would I go about changing the materials for all children to the default-material gray, then back to the normal material when switching the switch back?

bool changed;
Renderer rn;
Color col;
void Start(){
for (int i = 0; i < transform.childCount; i++) {
rn = gameObject.GetComponentsInChildren ();
col = rn .material.color;

  •   }*
    
  • }*
  • public void ChangeColor(){ //call this function from On Click event*
  •   if (changed) {*
    
  •   	for (int i = 0; i < rn.Length; i++) {*
    

_ rn .material.color = col;_
* changed = false;*
* }*
* } else {*
* for (int i = 0; i < rn.Length; i++) {*
_ rn .material.color = Color.gray;
* changed = true;
}
}
}*_