# SetFlags

> Sets the specified flags on all hierarchy nodes.

## Definition

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

## SetFlags(HierarchyNodeFlags)

Sets the specified flags on all hierarchy nodes.

```csharp
public void SetFlags(HierarchyNodeFlags flags)
```

### Parameters

**** (\[HierarchyNodeFlags]\(/engine/6000.7/script-reference/unity/hierarchy/hierarchynodeflags)): The flags to set on all hierarchy nodes in the view model.

## SetFlags(HierarchyNode, HierarchyNodeFlags)

Sets the specified flags on the hierarchy node.

```csharp
public void SetFlags(in HierarchyNode node, HierarchyNodeFlags flags)
```

### Parameters

**** (\[HierarchyNode]\(/engine/6000.7/script-reference/unity/hierarchy/hierarchynode)): The hierarchy node to set the flags on.**** (\[HierarchyNodeFlags]\(/engine/6000.7/script-reference/unity/hierarchy/hierarchynodeflags)): The flags to set on the hierarchy node.

## SetFlags(ReadOnlySpan\<HierarchyNode>, HierarchyNodeFlags)

Sets the specified flags on the hierarchy nodes.

```csharp
public int SetFlags(ReadOnlySpan<HierarchyNode> nodes, HierarchyNodeFlags flags)
```

### Parameters

**** (\[ReadOnlySpan\<HierarchyNode>]\(https\://learn.microsoft.com/dotnet/api/system.readonlyspan-1)): The hierarchy nodes to set the flags on.**** (\[HierarchyNodeFlags]\(/engine/6000.7/script-reference/unity/hierarchy/hierarchynodeflags)): The flags to set on the specified hierarchy nodes.

### Returns

| Type                                                       | Description                                   |
| ---------------------------------------------------------- | --------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The number of nodes that had their flags set. |

### Remarks

Null or invalid nodes are ignored.

## SetFlags(ReadOnlySpan\<int>, HierarchyNodeFlags)

Sets the specified flags on the hierarchy node indices.

```csharp
public int SetFlags(ReadOnlySpan<int> indices, HierarchyNodeFlags flags)
```

### Parameters

**** (\[ReadOnlySpan\<int>]\(https\://learn.microsoft.com/dotnet/api/system.readonlyspan-1)): The hierarchy node indices to set the flags on.**** (\[HierarchyNodeFlags]\(/engine/6000.7/script-reference/unity/hierarchy/hierarchynodeflags)): The flags to set on the hierarchy nodes at the specified indices.

### Returns

| Type                                                       | Description                                   |
| ---------------------------------------------------------- | --------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The number of nodes that had their flags set. |

### Remarks

Invalid node indices are ignored.
