Example #1
0
 private static void CompileIntoTransform(HierarchyComponent comp)
 {
     for (int i = 0; i < comp.Reference.transform.childCount; i++)
     {
         if (!comp.Children.ContainsKey(comp.Reference.transform.GetChild(i)))
         {
             comp.Children[comp.Reference.transform.GetChild(i)] = new HierarchyComponent(comp.Reference.transform.GetChild(i).gameObject, false);
         }
         CompileIntoTransform(comp.Children[comp.Reference.transform.GetChild(i)]);
     }
 }
Example #2
0
        //Compiles all transforms currently in the scene into the dictionary.
        public static void CompileExistingTransforms()
        {
            Transform[] allTransforms = GameObject.FindObjectsOfType <Transform>();

            foreach (Transform t in allTransforms)
            {
                //If this object is on the root of the scene, we iterate downward through all it's children and add them all.
                if (t.root == t)
                {
                    if (t == null)
                    {
                        continue;
                    }

                    if (!fullHierarchy.ContainsKey(t))
                    {
                        fullHierarchy[t] = new HierarchyComponent(t.gameObject, false);
                    }

                    CompileIntoTransform(fullHierarchy[t]);
                }
            }
        }
Example #3
0
        /// <summary>
        /// Compiles all transforms currently in the scene into the dictionary.
        /// </summary>
        public static void CompileExistingTransforms()
        {
            Transform[] allTransforms = Object.FindObjectsOfType <Transform>();

            foreach (Transform t in allTransforms)
            {
                // If this object is on the root of the scene, we iterate downward through all it's children and add them all.
                if (t.root == t)
                {
                    if (t == null)
                    {
                        continue;
                    }

                    HierarchyComponent component;
                    if (!_FullHierarchy.TryGetValue(t, out component))
                    {
                        component = _FullHierarchy[t] = new HierarchyComponent(t.gameObject, false);
                    }

                    CompileIntoTransform(component);
                }
            }
        }