# HierarchyViewModel

> A hierarchy view model is a read-only filtering view of a HierarchyViewModel.HierarchyFlattened.

## Definition

* **Type:** Class
* **Namespace:** [Unity.Hierarchy](/engine/6000.0/script-reference/unity/hierarchy.md)
* **Assembly:** UnityEngine.HierarchyCoreModule
* **Implements:** [IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable)

```csharp
public sealed class HierarchyViewModel : IDisposable
```

## Constructors

| Constructor                                                                                                                                                             | Description                                                                                                   |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| [HierarchyViewModel(Unity.Hierarchy.HierarchyFlattened,Unity.Hierarchy.HierarchyNodeFlags)](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/ctor.md) | Cosntructs a new [HierarchyViewModel](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel.md). |

## Properties

| Property                                                                                                       | Description                                                                                                                                     |
| -------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| [Count](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/count.md)                           | The total number of nodes.                                                                                                                      |
| [Hierarchy](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/hierarchy.md)                   | Accesses the [HierarchyViewModel.Hierarchy](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/hierarchy.md).                   |
| [HierarchyFlattened](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/hierarchyflattened.md) | Accesses the [HierarchyViewModel.HierarchyFlattened](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/hierarchyflattened.md). |
| [IsCreated](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/iscreated.md)                   | Whether this object is valid and uses memory.                                                                                                   |
| [this\[\]](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/item.md)                         | Gets the [HierarchyNode](/engine/6000.0/script-reference/unity/hierarchy/hierarchynode.md) at a specified index.                                |
| [UpdateNeeded](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/updateneeded.md)             | Whether the hierarchy view model requires an update.                                                                                            |
| [Updating](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/updating.md)                     | Whether the hierarchy view model is currently updating.                                                                                         |

## Methods

| Method                                                                                                                               | Description                                                                                                                                                                                                                                                                                                  |
| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [ClearFlags](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/clearflags.md)                                       | Clears the specified flags on the hierarchy node indices.                                                                                                                                                                                                                                                    |
| [Contains](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/contains.md)                                           | Determines if a specified node is in the hierarchy view model.                                                                                                                                                                                                                                               |
| [Dispose](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/dispose.md)                                             | Disposes this object and releases its memory.                                                                                                                                                                                                                                                                |
| [DoesNotHaveAllFlags](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/doesnothaveallflags.md)                     | Gets whether or not all of the specified flags are not set on the hierarchy node.                                                                                                                                                                                                                            |
| [DoesNotHaveAllFlagsCount](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/doesnothaveallflagscount.md)           | Gets the number of nodes that do not have all of the specified flags set.                                                                                                                                                                                                                                    |
| [DoesNotHaveAnyFlags](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/doesnothaveanyflags.md)                     | Gets whether or not any of the specified flags are not set on the hierarchy node.                                                                                                                                                                                                                            |
| [DoesNotHaveAnyFlagsCount](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/doesnothaveanyflagscount.md)           | Gets the number of nodes that do not have any of the specified flags set.                                                                                                                                                                                                                                    |
| [EnumerateNodesWithAllFlags](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/enumeratenodeswithallflags.md)       | Gets an enumerable of all hierarchy nodes that have all of the specified flags set.                                                                                                                                                                                                                          |
| [EnumerateNodesWithAnyFlags](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/enumeratenodeswithanyflags.md)       | Gets an enumerable of all hierarchy nodes that have any of the specified flags set.                                                                                                                                                                                                                          |
| [EnumerateNodesWithoutAllFlags](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/enumeratenodeswithoutallflags.md) | Gets an enumerable of all hierarchy nodes that do not have all of the specified flags set.                                                                                                                                                                                                                   |
| [EnumerateNodesWithoutAnyFlags](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/enumeratenodeswithoutanyflags.md) | Gets an enumerable of all hierarchy nodes that do not have any of the specified flags set.                                                                                                                                                                                                                   |
| [GetChildrenCount](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/getchildrencount.md)                           | Gets the number of child nodes that a hierarchy node has.                                                                                                                                                                                                                                                    |
| [GetChildrenCountRecursive](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/getchildrencountrecursive.md)         | Gets the number of child nodes that a hierarchy node has, including children of children.                                                                                                                                                                                                                    |
| [GetDepth](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/getdepth.md)                                           | Determines the depth of a node.                                                                                                                                                                                                                                                                              |
| [GetEnumerator](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/getenumerator.md)                                 | Gets the [HierarchyNode](/engine/6000.0/script-reference/unity/hierarchy/hierarchynode.md) enumerator.                                                                                                                                                                                                       |
| [GetFlags](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/getflags.md)                                           | Gets all the flags set on a given hierarchy node.                                                                                                                                                                                                                                                            |
| [GetIndicesWithAllFlags](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/getindiceswithallflags.md)               | Gets the indices for all hierarchy nodes that have all of the specified flags set.                                                                                                                                                                                                                           |
| [GetIndicesWithAnyFlags](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/getindiceswithanyflags.md)               | Gets the indices for all hierarchy nodes that have any of the specified flags set.                                                                                                                                                                                                                           |
| [GetIndicesWithoutAllFlags](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/getindiceswithoutallflags.md)         | Gets the indices of all hierarchy nodes that do not have all of the specified flags set.                                                                                                                                                                                                                     |
| [GetIndicesWithoutAnyFlags](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/getindiceswithoutanyflags.md)         | Gets the indices of all hierarchy nodes that do not have any of the specified flags set.                                                                                                                                                                                                                     |
| [GetNextSibling](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/getnextsibling.md)                               | Gets the next sibling of a node.                                                                                                                                                                                                                                                                             |
| [GetNodesWithAllFlags](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/getnodeswithallflags.md)                   | Gets all hierarchy nodes that have all of the specified flags set.                                                                                                                                                                                                                                           |
| [GetNodesWithAnyFlags](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/getnodeswithanyflags.md)                   | Gets all hierarchy nodes that have any of the specified flags set.                                                                                                                                                                                                                                           |
| [GetNodesWithoutAllFlags](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/getnodeswithoutallflags.md)             | Gets all hierarchy nodes that do not have all of the specified flags set.                                                                                                                                                                                                                                    |
| [GetNodesWithoutAnyFlags](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/getnodeswithoutanyflags.md)             | Gets all hierarchy nodes that do not have any of the specified flags set.                                                                                                                                                                                                                                    |
| [GetParent](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/getparent.md)                                         | Gets the parent of a hierarchy node.                                                                                                                                                                                                                                                                         |
| [HasAllFlags](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/hasallflags.md)                                     | Gets whether or not all of the specified flags are set on the hierarchy node.                                                                                                                                                                                                                                |
| [HasAllFlagsCount](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/hasallflagscount.md)                           | Gets the number of nodes that have all of the specified flags set.                                                                                                                                                                                                                                           |
| [HasAnyFlags](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/hasanyflags.md)                                     | Gets whether or not any of the specified flags are set on the hierarchy node.                                                                                                                                                                                                                                |
| [HasAnyFlagsCount](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/hasanyflagscount.md)                           | Gets the number of nodes that have any of the specified flags set.                                                                                                                                                                                                                                           |
| [IndexOf](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/indexof.md)                                             | Gets the zero-based index of a specified node.                                                                                                                                                                                                                                                               |
| [SetFlags](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/setflags.md)                                           | Sets the specified flags on the hierarchy node indices.                                                                                                                                                                                                                                                      |
| [SetQuery](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/setquery.md)                                           | Sets the search query.                                                                                                                                                                                                                                                                                       |
| [ToggleFlags](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/toggleflags.md)                                     | Toggles the specified flags on the hierarchy node indices.                                                                                                                                                                                                                                                   |
| [Update](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/update.md)                                               | Updates the hierarchy view model and requests a rebuild of the list of [HierarchyNode](/engine/6000.0/script-reference/unity/hierarchy/hierarchynode.md) that filters the [HierarchyViewModel.HierarchyFlattened](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/hierarchyflattened.md). |
| [UpdateIncremental](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/updateincremental.md)                         | Updates the hierarchy view model incrementally.                                                                                                                                                                                                                                                              |
| [UpdateIncrementalTimed](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/updateincrementaltimed.md)               | Updates the hierarchy view model incrementally until a time limit is reached.                                                                                                                                                                                                                                |

## Structs

| Struct                                                                                                            | Description                                                                                                                                        |
| ----------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| [HierarchyViewModel.Enumerator](/engine/6000.0/script-reference/unity/hierarchy/hierarchyviewmodel/enumerator.md) | An enumerator of [HierarchyNode](/engine/6000.0/script-reference/unity/hierarchy/hierarchynode.md). Enumerates and filters items at the same time. |
