示例#1
0
 private static void SetGameObjectLayer(GameObject root, int layerValue, int ignoreType)
 {
     if (layerValue >= 0 && layerValue <= 31 && root != null)
     {
         if (!LayerSystem.IsIgnoreLayers(root.get_layer(), ignoreType))
         {
             root.set_layer(layerValue);
         }
         LayerSystem.SetChildLayerRecursively(root.get_transform(), layerValue, ignoreType);
     }
 }
示例#2
0
 private static void SetChildLayerRecursively(Transform childTransform, int layerValue, int ignoreType)
 {
     if (layerValue >= 0 && layerValue <= 31)
     {
         for (int i = 0; i < childTransform.get_childCount(); i++)
         {
             Transform child = childTransform.GetChild(i);
             if (!LayerSystem.IsIgnoreLayers(child.get_gameObject().get_layer(), ignoreType))
             {
                 child.get_gameObject().set_layer(layerValue);
             }
             LayerSystem.SetChildLayerRecursively(child, layerValue, ignoreType);
         }
     }
 }