# GetOrCreateNode

> Gets or creates the HierarchyNode for the subscene with the specified EntityId.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Hierarchy.Editor](/engine/6000.5/script-reference/unity/hierarchy/editor.md)
* **Assembly:** UnityEditor

## GetOrCreateNode(EntityId)

Gets or creates the [HierarchyNode](/engine/6000.5/script-reference/unity/hierarchy/hierarchynode.md) for the subscene with the specified [EntityId](/engine/6000.5/script-reference/unityengine/entityid.md).

```csharp
public HierarchyNode GetOrCreateNode(EntityId entityId)
```

### Parameters

**** (\[EntityId]\(/engine/6000.5/script-reference/unityengine/entityid)): The [EntityId](/engine/6000.5/script-reference/unityengine/entityid.md) of the subscene to find or create a node for.

### Returns

| Type                                                                              | Description                                                                                                       |
| --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| [HierarchyNode](/engine/6000.5/script-reference/unity/hierarchy/hierarchynode.md) | The [HierarchyNode](/engine/6000.5/script-reference/unity/hierarchy/hierarchynode.md) for the specified subscene. |

### Remarks

If the node doesn't exist yet, this method returns a future node that will be used for the scene. Update the [Hierarchy](/engine/6000.5/script-reference/unity/hierarchy/hierarchy.md) before you query it about this node.

## GetOrCreateNode(GameObject)

Gets or creates the [HierarchyNode](/engine/6000.5/script-reference/unity/hierarchy/hierarchynode.md) for the subscene represented by the specified [GameObject](/engine/6000.5/script-reference/unityengine/gameobject.md).

```csharp
public HierarchyNode GetOrCreateNode(GameObject gameObject)
```

### Parameters

**** (\[GameObject]\(/engine/6000.5/script-reference/unityengine/gameobject)): The [GameObject](/engine/6000.5/script-reference/unityengine/gameobject.md) that represents the subscene.

### Returns

| Type                                                                              | Description                                                                                                                                                                                                                                                                                              |
| --------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [HierarchyNode](/engine/6000.5/script-reference/unity/hierarchy/hierarchynode.md) | The [HierarchyNode](/engine/6000.5/script-reference/unity/hierarchy/hierarchynode.md) for the specified subscene, or [HierarchyNode.Null](/engine/6000.5/script-reference/unity/hierarchy/hierarchynode/null.md) if the [GameObject](/engine/6000.5/script-reference/unityengine/gameobject.md) is null. |

### Remarks

If the node doesn't exist yet, this method returns a future node that will be used for the scene. Update the [Hierarchy](/engine/6000.5/script-reference/unity/hierarchy/hierarchy.md) before you query it about this node.

## GetOrCreateNode(Scene)

Gets or creates the [HierarchyNode](/engine/6000.5/script-reference/unity/hierarchy/hierarchynode.md) for the specified subscene.

```csharp
public HierarchyNode GetOrCreateNode(Scene scene)
```

### Parameters

**** (\[Scene]\(/engine/6000.5/script-reference/unityengine/scenemanagement/scene)): The [Scene](/engine/6000.5/script-reference/unityengine/scenemanagement/scene.md) associated with the subscene.

### Returns

| Type                                                                              | Description                                                                                                       |
| --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| [HierarchyNode](/engine/6000.5/script-reference/unity/hierarchy/hierarchynode.md) | The [HierarchyNode](/engine/6000.5/script-reference/unity/hierarchy/hierarchynode.md) for the specified subscene. |

### Remarks

If the node doesn't exist yet, this method returns a future node that will be used for the scene. Update the [Hierarchy](/engine/6000.5/script-reference/unity/hierarchy/hierarchy.md) before you query it about this node.
