# INodeView

> The generated view for a Node, exposed to NodeView<T> implementations so they can add custom UI to the node.

## Definition

* **Type:** Interface
* **Namespace:** [Unity.GraphToolkit.Editor](/engine/6000.7/script-reference/unity/graphtoolkit/editor.md)
* **Assembly:** UnityEditor

```csharp
public interface INodeView
```

## Remarks

Allocate custom UI in [NodeView\<T>.OnViewBuilt](/engine/6000.7/script-reference/unity/graphtoolkit/editor/nodeview1/onviewbuilt.md) and add it to [INodeView.Root](/engine/6000.7/script-reference/unity/graphtoolkit/editor/inodeview/root.md). The contents of [INodeView.Root](/engine/6000.7/script-reference/unity/graphtoolkit/editor/inodeview/root.md) are cleared whenever the node returns from being culled, so cache your custom elements in fields and re-add them from [NodeView\<T>.OnCullingChanged](/engine/6000.7/script-reference/unity/graphtoolkit/editor/nodeview1/oncullingchanged.md) (when `cullingEnabled` is false).

Additional Resources: [NodeView\<T>](/engine/6000.7/script-reference/unity/graphtoolkit/editor/nodeview1.md), [NodeView\<T>.OnViewBuilt](/engine/6000.7/script-reference/unity/graphtoolkit/editor/nodeview1/onviewbuilt.md)

## Examples

```csharp
class MyNodeView : NodeView<MyNode>
{
    Label m_Label;

    public override void OnViewBuilt()
    {
        m_Label = new Label($"Node: {Node.Title}");
        View.Root.Add(m_Label);
    }

    public override void OnCullingChanged(bool cullingEnabled)
    {
        if (!cullingEnabled && m_Label != null)
            View.Root.Add(m_Label);
    }
}
```

## Properties

| Property                                                                            | Description                                                                                                                                     |
| ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| [Root](/engine/6000.7/script-reference/unity/graphtoolkit/editor/inodeview/root.md) | The root [VisualElement](/engine/6000.7/script-reference/unityengine/uielements/visualelement.md) of the node, to which custom UI can be added. |
