コード例 #1
0
        private void linkUpChildren(SDFNode node, Transform t)
        {
            for (int i = 0; i < t.childCount; i++)
            {
                var child = t.GetChild(i);
                if (!child.gameObject.activeInHierarchy)
                {
                    continue;
                }

                t.GetChild(i).GetComponents(_tmpList);

                bool foundChild = false;
                for (int j = 0; j < _tmpList.Count; j++)
                {
                    if (_tmpList[j].isActiveAndEnabled)
                    {
                        node.Add(_tmpList[j].GetNode());
                        foundChild = true;
                        break;
                    }
                }

                if (foundChild)
                {
                    continue;
                }

                linkUpChildren(node, t.GetChild(i));
            }
        }
コード例 #2
0
 private void linkUpChildren(SDFNode node, Transform t)
 {
     for (int i = 0; i < t.childCount; i++)
     {
         t.GetChild(i).GetComponents(_tmpList);
         if (_tmpList.Count > 0)
         {
             node.Add(_tmpList[0].GetNode());
         }
         else
         {
             linkUpChildren(node, t.GetChild(i));
         }
     }
 }