# GetIndicesWithFlags

> Gets the indices for all hierarchy nodes that have all of the specified flags set.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Hierarchy](/engine/6000.7/script-reference/unity/hierarchy.md)
* **Assembly:** UnityEngine.HierarchyCoreModule

## GetIndicesWithFlags(HierarchyNodeFlags, Span\<int>)

Gets the indices for all hierarchy nodes that have all of the specified flags set.

```csharp
public int GetIndicesWithFlags(HierarchyNodeFlags flags, Span<int> outIndices)
```

### Parameters

**** (\[HierarchyNodeFlags]\(/engine/6000.7/script-reference/unity/hierarchy/hierarchynodeflags)): The flags to match against hierarchy nodes.**** (\[Span\<int>]\(https\://learn.microsoft.com/dotnet/api/system.span-1)): The output span to write matching hierarchy node indices into.

### Returns

| Type                                                       | Description                                             |
| ---------------------------------------------------------- | ------------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The number of indices written in the `outIndices` span. |

## GetIndicesWithFlags(HierarchyNodeFlags)

Gets the indices for all hierarchy nodes that have all of the specified flags set.

```csharp
public int[] GetIndicesWithFlags(HierarchyNodeFlags flags)
```

### Parameters

**** (\[HierarchyNodeFlags]\(/engine/6000.7/script-reference/unity/hierarchy/hierarchynodeflags)): The flags to match against hierarchy nodes.

### Returns

| Type                                                           | Description                                                                                         |
| -------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| [int\[\]](https://learn.microsoft.com/dotnet/api/system.int32) | An array that contains the indices of all hierarchy nodes that have all of the specified flags set. |
