# CoherenceNode

The `CoherenceNode` component is used to prepare a network entity that needs to be parented to another network entity at a **deep level** – that is, not as a direct child. You only need `CoherenceNode` if the object needs to be a child of a child, or more.

<figure><img src="/files/bcUpPduADfztx0aUQPOu" alt="" width="563"><figcaption><p>A CoherenceNode component</p></figcaption></figure>

The goal of the `CoherenceNode` component is to keep track of where the object is in the hierarchy, so when it's reparented by its owner coherence is able to replicate the same hierarchy structure on each connected Client.

However, as a user you don't need to do anything about it. You just apply the component to a network entity, and coherence will take care of the rest for you. Happy re-parenting!

{% hint style="info" %}
To get familiar with all parenting options, we strongly recommend to read the [Parenting network entities](/1.6/manual/parenting-network-entities.md) section.
{% endhint %}

## Inner workings

{% hint style="info" %}
This section is only interesting if you want to understand deeply how `CoherenceNode` works under the hood.
{% endhint %}

`CoherenceNode` works using two public fields which are automatically set to sync using the `[Sync]` attribute.

```csharp
[Sync] public string path;
[Sync] public int pathDirtyCounter;
```

The `path` variable describes where in the parent's hierarchy the child object should be located. It is a string consisting of comma-separated indexes. Every one of these indexes designates a specific child index in the hierarchy. The child object which has the `CoherenceNode` component will be placed in the resulting place in the hierarchy.

The `pathDirtyCounter` variable is a helper variable used to keep track of the applied hierarchy changes. In case the object's position in the parent's hierarchy changes, this variable will be used to help settle and properly sync those changes.

<img src="/files/YodVU7JdVUIz9WEKiy5t" alt="" width="563">


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.coherence.io/1.6/manual/components/coherence-node.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
