public void FillListRoot(Transform root)
        {
            GuiListItem glia = this.getGuiListItem(root);

            if (glia != null)
            {
                glia.enable();
                glia.showChildren = true;
            }
        }
 // show only items that are the root and its children
 public void FillList(Transform root)
 {
     foreach (Transform child in root)
     {
         GuiListItem gli = this.getGuiListItem(child);
         if (gli != null)
         {
             gli.enable();
             gli.showChildren = false;
         }
     }
 }
        // turn off children objects
        public void ClearList(Transform root)
        {
            Transform[] childs = root.GetComponentsInChildren <Transform>();
            foreach (Transform child in childs)
            {
                if (child == root)
                {
                    continue;                        //don't run clearlist on the root
                }
                GuiListItem gli = this.getGuiListItem(child);

                gli.disable();
                gli.showChildren = false;
            }
        }
        public void HandleSelectedButton(int selection)
        {
            // do the stuff, camera etc
            GuiListItem selected = MyListOfStuff[selection];

            selectedItemCaption = selected.Name;
            lastCaption         = selectedItemCaption; //to prevent from refreshing stuff..

            currentRoot = selected.transform;


            // toggle item show child
            selected.showChildren = !selected.showChildren;

            // fill my drop down list with the children of the current selected object
            if (selected.showChildren)
            {
                FillList(currentRoot);
            }
            else
            {
                ClearList(currentRoot);
            }
        }
        public override void DrawGUI()
        {
            this.UpdateTextBox();
            if (!this.visible)
            {
                return;
            }


            //***********************************************************************
            // Dropdown box, with searcher button, clear button and refresh button  *
            //***********************************************************************
            GUILayout.BeginArea(DropDownRect, "", "box");
            GUILayout.BeginHorizontal();
            string ButtonText = (DropdownVisible) ? "<<" : ">>";

            DropdownVisible = GUILayout.Toggle(DropdownVisible, ButtonText, "button", GUILayout.Width(32), GUILayout.Height(20));
            GUI.SetNextControlName("PartSelect");
            selectedItemCaption = GUILayout.TextField(selectedItemCaption);
            clearDropList       = GUILayout.Toggle(clearDropList, "Clear", "button", GUILayout.Width(40), GUILayout.Height(20));
            bool shouldRefresh = GUILayout.Button("Refresh", "button", GUILayout.Width(40), GUILayout.Height(20));

            GUILayout.EndHorizontal();
            GUILayout.EndArea();

            //***********************************************************************
            // Tree list with all items                                             *
            //***********************************************************************
            //Show the dropdown list if required (make sure any controls that should appear behind the list are before this block)
            if (DropdownVisible)
            {
                GUI.SetNextControlName("ScrollView");
                GUILayout.BeginArea(new Rect(this.canvas.xMin,
                                             this.canvas.yMin + DropDownRect.height,
                                             this.canvas.width,
                                             this.canvas.height - (DropDownRect.height)),
                                    GUI.skin.box);
                ListScrollPos = GUILayout.BeginScrollView(ListScrollPos, dropSkin.scrollView);
                GUILayout.BeginVertical();

                for (int i = 0; i < MyListOfStuff.Count; i++)
                {
                    GuiListItem gli = MyListOfStuff[i];


                    if (gli.Selected)
                    {
                        GUILayout.BeginHorizontal(GUILayout.Height(15));
                        GUILayout.Space(15 * gli.Depth);
                        if (GUILayout.Button(" ", dropSkin.customStyles[gli.GuiStyle])) //if they press
                        {
                            HandleSelectedButton(i);
                        }

                        if (gli.transform == this.selectedTransform)                                      //whether to make it red.
                        {
                            GUILayout.Button(gli.Name, dropSkin.customStyles[DebugDropDownList.redText]); //button that does nothing.
                        }
                        else
                        {
                            if (GUILayout.Button(gli.Name, dropSkin.button))                     //if they press the name
                            {
                                HandleSelectedText(i);
                            }
                        }


                        GUILayout.EndHorizontal();
                    }
                }
                GUILayout.EndVertical();
                GUILayout.EndScrollView();
                GUILayout.EndArea();
            }



            if (shouldRefresh)
            {
                this.refreshDropList();
            }
        }