示例#1
0
 public static void ForeachGameObjectRecursively(GameObject root, System.Action <GameObject> func)
 {
     if (root == null || func == null)
     {
         return;
     }
     func(root);
     foreach (Transform t in root.transform)
     {
         XUtility.ForeachGameObjectRecursively(t.gameObject, func);
     }
 }
示例#2
0
        public static void SetLayerRecursively(GameObject root, string layerName)
        {
            int layer = LayerMask.NameToLayer(layerName);

            XUtility.ForeachGameObjectRecursively(root, go => go.layer = layer);
        }