Пример #1
0
 private static void SetParentAndAlign(GameObject child, GameObject parent)
 {
     if (parent == null)
     {
         return;
     }
     child.transform.SetParent(parent.transform, false);
     TMP_DefaultControls.SetLayerRecursively(child, parent.layer);
 }
Пример #2
0
        private static void SetLayerRecursively(GameObject go, int layer)
        {
            go.layer = layer;
            Transform transform = go.transform;

            for (int i = 0; i < transform.childCount; i++)
            {
                TMP_DefaultControls.SetLayerRecursively(transform.GetChild(i).gameObject, layer);
            }
        }