Example #1
0
 public static int CountParents(GameObject go)
 {
     if (go.transform.parent)
     {
         return(1 + Inspector.CountParents(go.transform.parent.gameObject));
     }
     return(1);
 }
Example #2
0
 public static void CreateList(GameObject parentObject = null)
 {
     try
     {
         int layer = 0;
         if (parentObject != null)
         {
             layer = Inspector.CountParents(parentObject);
             try
             {
                 Inspector.CreateComponentList(parentObject);
             }
             catch (Exception)
             {
                 Debug.Log("Concurrent modification while listing thing?");
             }
         }
         for (int i = layer; i < Inspector.gameObjects.Length; i++)
         {
             Inspector.RemoveAllFromGUI(Inspector.gameObjects[i]);
             Inspector.gameObjects[i] = new List <CustomGUI>();
         }
         float             j          = 0.2f;
         List <GameObject> transforms = new List <GameObject>();
         if (!parentObject)
         {
             foreach (Scene scene in SceneManager.GetAllScenes())
             {
                 transforms.AddRange(new List <GameObject>(scene.GetRootGameObjects()));
             }
         }
         else
         {
             transforms = new List <GameObject>();
             foreach (object obj in parentObject.transform)
             {
                 Transform transform = (Transform)obj;
                 transforms.Add(transform.gameObject);
             }
         }
         using (List <GameObject> .Enumerator enumerator2 = transforms.GetEnumerator())
         {
             while (enumerator2.MoveNext())
             {
                 GameObject gameObject = enumerator2.Current;
                 Button     button4    = new Button(new Rect(0.1f * (float)layer, j, 0.1f, 0.02f), gameObject.name, JMTKGUI.GUIElement.Button, delegate()
                 {
                     try
                     {
                         Inspector.CreateList(gameObject);
                     }
                     catch (Exception e2)
                     {
                         Debug.Log(e2 + "\n" + e2.StackTrace);
                     }
                 });
                 j += 0.02f;
                 Inspector.gameObjects[layer].Add(button4);
             }
         }
         Inspector.AddAllToGUI(Inspector.gameObjects[layer]);
     }
     catch (Exception e)
     {
         Debug.Log(e + "\n" + e.StackTrace);
     }
 }