Exemple #1
0
        public void AddItem()
        {
            DataItem item   = new DataItem("New Item");
            DataItem parent = m_dataItems[m_counter];

            parent.Children.Add(item);

            TreeView.AddChild(parent, item);
            TreeView.Internal_Expand(parent);

            DataItem subItem = new DataItem("New Sub Item");

            item.Children.Add(subItem);

            TreeView.AddChild(item, subItem);
            TreeView.Internal_Expand(item);

            m_counter++;
            m_counter %= m_dataItems.Count;
        }
Exemple #2
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.E))
     {
         object dataItem = TreeView.Items.OfType <object>().First();
         if (TreeView.IsExpanded(dataItem))
         {
             TreeView.Internal_Collapse(dataItem);
         }
         else
         {
             TreeView.Internal_Expand(dataItem);
         }
     }
 }