docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class HierarchyTreeView

    Tree view GUI for the MARS Simulation View hierarchy Hierarchy to tree view starting code brought from

    Inheritance
    object
    TreeView
    HierarchyTreeView
    Inherited Members
    TreeView.Reload()
    TreeView.Repaint()
    TreeView.GetCellRectForTreeFoldouts(Rect)
    TreeView.GetRowRect(int)
    TreeView.GetRows()
    TreeView.FindRows(IList<int>)
    TreeView.FindItem(int, TreeViewItem)
    TreeView.FindRowOfItem(TreeViewItem)
    TreeView.GetFirstAndLastVisibleRows(out int, out int)
    TreeView.ExpandAll()
    TreeView.CollapseAll()
    TreeView.SetExpandedRecursive(int, bool)
    TreeView.SetExpanded(int, bool)
    TreeView.SetExpanded(IList<int>)
    TreeView.GetExpanded()
    TreeView.IsExpanded(int)
    TreeView.GetSelection()
    TreeView.SetSelection(IList<int>)
    TreeView.SetSelection(IList<int>, TreeViewSelectionOptions)
    TreeView.IsSelected(int)
    TreeView.HasSelection()
    TreeView.HasFocus()
    TreeView.SetFocus()
    TreeView.SetFocusAndEnsureSelectedItem()
    TreeView.SelectionClick(TreeViewItem, bool)
    TreeView.BeginRename(TreeViewItem)
    TreeView.BeginRename(TreeViewItem, float)
    TreeView.EndRename()
    TreeView.FrameItem(int)
    TreeView.OnGUI(Rect)
    TreeView.SelectAllRows()
    TreeView.GetFoldoutIndent(TreeViewItem)
    TreeView.GetContentIndent(TreeViewItem)
    TreeView.SortItemIDsInRowOrder(IList<int>)
    TreeView.CenterRectUsingSingleLineHeight(ref Rect)
    TreeView.AddExpandedRows(TreeViewItem, IList<TreeViewItem>)
    TreeView.SingleClickedItem(int)
    TreeView.ContextClickedItem(int)
    TreeView.ContextClicked()
    TreeView.ExpandedStateChanged()
    TreeView.SearchChanged(string)
    TreeView.KeyEvent()
    TreeView.CanMultiSelect(TreeViewItem)
    TreeView.CanRename(TreeViewItem)
    TreeView.RenameEnded(TreeView.RenameEndedArgs)
    TreeView.CanStartDrag(TreeView.CanStartDragArgs)
    TreeView.SetupDragAndDrop(TreeView.SetupDragAndDropArgs)
    TreeView.HandleDragAndDrop(TreeView.DragAndDropArgs)
    TreeView.CanBeParent(TreeViewItem)
    TreeView.CanChangeExpandedState(TreeViewItem)
    TreeView.DoesItemMatchSearch(TreeViewItem, string)
    TreeView.BeforeRowsGUI()
    TreeView.AfterRowsGUI()
    TreeView.RefreshCustomRowHeights()
    TreeView.GetCustomRowHeight(int, TreeViewItem)
    TreeView.GetRenameRect(Rect, int, TreeViewItem)
    TreeView.CommandEventHandling()
    TreeView.SetupParentsAndChildrenFromDepths(TreeViewItem, IList<TreeViewItem>)
    TreeView.SetupDepthsFromParentsAndChildren(TreeViewItem)
    TreeView.CreateChildListForCollapsedParent()
    TreeView.IsChildListForACollapsedParent(IList<TreeViewItem>)
    TreeView.getNewSelectionOverride
    TreeView.foldoutOverride
    TreeView.state
    TreeView.multiColumnHeader
    TreeView.rootItem
    TreeView.hoveredItem
    TreeView.enableItemHovering
    TreeView.isInitialized
    TreeView.treeViewRect
    TreeView.baseIndent
    TreeView.foldoutWidth
    TreeView.extraSpaceBeforeIconAndLabel
    TreeView.customFoldoutYOffset
    TreeView.columnIndexForTreeFoldouts
    TreeView.useScrollView
    TreeView.depthIndentWidth
    TreeView.showAlternatingRowBackgrounds
    TreeView.showBorder
    TreeView.showingHorizontalScrollBar
    TreeView.showingVerticalScrollBar
    TreeView.cellMargin
    TreeView.totalHeight
    TreeView.rowHeight
    TreeView.treeViewControlID
    TreeView.isDragging
    TreeView.hasSearch
    TreeView.searchString
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEditor.MARS.Simulation
    Assembly: Unity.MARS.Editor.dll
    Syntax
    [MovedFrom("Unity.MARS")]
    public class HierarchyTreeView : TreeView

    Constructors

    HierarchyTreeView(TreeViewState, HierarchyState, bool, bool)

    Creates the HierarchyTreeView for a simulation hierarchy

    Declaration
    public HierarchyTreeView(TreeViewState treeViewState, HierarchyState hierarchyState, bool isEnvironmentHierarchy, bool needsStateCached)
    Parameters
    Type Name Description
    TreeViewState treeViewState

    The serializable state of the tree view

    HierarchyState hierarchyState

    State of the tree view with extra data for the simulation

    bool isEnvironmentHierarchy

    Is the tree view for the simulated environment

    bool needsStateCached

    Is the cached state being cached or restored

    Properties

    MaxHeight

    The maximum height of the tree view's scroll area

    Declaration
    public float MaxHeight { get; set; }
    Property Value
    Type Description
    float

    StyleName

    Sets the GUIStyle name for the tree view's container

    Declaration
    public string StyleName { get; set; }
    Property Value
    Type Description
    string

    horizontalOffset

    Offset for tree view GUI drawing, used for horizontal scrolling

    Declaration
    public float horizontalOffset { get; protected set; }
    Property Value
    Type Description
    float

    selectedRowY

    The height of the selected row

    Declaration
    public float selectedRowY { get; set; }
    Property Value
    Type Description
    float

    Methods

    BuildRoot()

    Creates the full tree of the TreeViewItems and returns the root

    Declaration
    protected override TreeViewItem BuildRoot()
    Returns
    Type Description
    TreeViewItem

    The root of the tree. This item can later be accessed by 'rootItem'.

    Overrides
    TreeView.BuildRoot()

    BuildRows(TreeViewItem)

    Generates the rows in the TreeView

    Declaration
    protected override IList<TreeViewItem> BuildRows(TreeViewItem treeRoot)
    Parameters
    Type Name Description
    TreeViewItem treeRoot

    Root item that was created in the BuildRoot method.

    Returns
    Type Description
    IList<TreeViewItem>

    The rows list shown in the TreeView. Can later be accessed using GetRows().

    Overrides
    TreeView.BuildRows(TreeViewItem)

    CacheState()

    Cache the state based on the transform so when they IDs change on re-simulation the state can be restored

    Declaration
    public void CacheState()

    DoubleClickedItem(int)

    Method to handle double click events on an item.

    Declaration
    protected override void DoubleClickedItem(int id)
    Parameters
    Type Name Description
    int id

    ID of TreeViewItem that was double clicked.

    Overrides
    TreeView.DoubleClickedItem(int)

    DrawScrollingTreeView(Vector2, ref bool, bool)

    Draw the hierarchy tree view the horizontal and vertical scrolling

    Declaration
    public Vector2 DrawScrollingTreeView(Vector2 scrollPosition, ref bool scrollToSelected, bool enabled)
    Parameters
    Type Name Description
    Vector2 scrollPosition

    Scrolling position

    bool scrollToSelected

    Scroll to the selected item in the hierarchy

    bool enabled

    Is the simulation active to so the hierarchy can be displayed

    Returns
    Type Description
    Vector2

    ~HierarchyTreeView()

    Declaration
    protected ~HierarchyTreeView()

    GetAncestors(int)

    This method is e.g. used for revealing items that are currently under a collapsed item.

    Declaration
    protected override IList<int> GetAncestors(int id)
    Parameters
    Type Name Description
    int id

    TreeViewItem ID.

    Returns
    Type Description
    IList<int>

    List of all the ancestors of a given item with ID id.

    Overrides
    TreeView.GetAncestors(int)

    GetDescendantsThatHaveChildren(int)

    Returns all descendants for the item with ID id that have children.

    Declaration
    protected override IList<int> GetDescendantsThatHaveChildren(int id)
    Parameters
    Type Name Description
    int id

    TreeViewItem ID.

    Returns
    Type Description
    IList<int>

    Descendants that have children.

    Overrides
    TreeView.GetDescendantsThatHaveChildren(int)

    PingObjects(Transform[])

    Ping the selected items in the hierarchy

    Declaration
    public static void PingObjects(Transform[] selection)
    Parameters
    Type Name Description
    Transform[] selection

    RestoreState()

    Restore the previously cached state

    Declaration
    public void RestoreState()

    RowGUI(RowGUIArgs)

    Method to add GUI content for the rows in the TreeView.

    Declaration
    protected override void RowGUI(TreeView.RowGUIArgs args)
    Parameters
    Type Name Description
    TreeView.RowGUIArgs args

    Row data.

    Overrides
    UnityEditor.IMGUI.Controls.TreeView.RowGUI(UnityEditor.IMGUI.Controls.TreeView.RowGUIArgs)

    SelectionChanged(IList<int>)

    Method to get notified of selection changes.

    Declaration
    protected override void SelectionChanged(IList<int> selectedIds)
    Parameters
    Type Name Description
    IList<int> selectedIds

    TreeViewItem IDs.

    Overrides
    TreeView.SelectionChanged(IList<int>)

    UnsetPing()

    Clear the pinged items

    Declaration
    public static void UnsetPing()
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)