c# set object child layer
// Check if game object has child:
if (transform.childCount >= 0)
{
// Set child layer:
foreach (Transform child in gameObject.GetComponentsInChildren<Transform>(true))
{
child.gameObject.layer = LayerMask.NameToLayer("Default");
}
}