public static void ChangeLayerIncludeChildren(this Transform root, LayerInfo layer) { var max = root.childCount; root.gameObject.layer = layer.Index; for (int index = 0; index < max; ++index) { var child = root.GetChild(index); child.ChangeLayerIncludeChildren(layer); } }
public static void ChangeLayerIncludeChildren(this GameObject root, LayerInfo layer) { root.transform.ChangeLayerIncludeChildren(layer); }