public void toggleAnimatorOfAllChildren(bool b) { foreach (Transform child in transform) { Animator anim = child.GetComponent <Animator>(); ForAllChildren fac = child.gameObject.GetComponent <ForAllChildren>(); if (anim != null) { anim.enabled = b; } if (fac != null) { fac.toggleAnimatorOfAllChildren(b); } } }
void setVisibilityOfAllChildren(bool visible) { ForAllChildren sr = gameObject.GetComponent <ForAllChildren>(); sr.setColorOfAllChildren((visible) ? Color.white : Color.grey); }