# Implement context nodes for your graph tool

> Create context nodes to organize and contain block nodes in the graph tool.

Create context nodes to organize and contain block nodes in the graph tool.

Context nodes provide context-specific information or functionality and contain only block nodes. A context node inherits all features available in its parent `Node` class.

This page covers how to implement context nodes only. For information on how to implement block nodes, refer to [Implement block nodes for your graph tool](/engine/6000.7/manual/extending-the-editor/gtk-index/implementing-a-graph-tool/implement-block-nodes.md). For information about node types, refer to [About nodes](/engine/6000.7/manual/extending-the-editor/gtk-index/implementing-a-graph-tool/node-introduction.md).

## Prerequisites

Before you can implement context nodes, you need to create a graph class. If you haven't done this yet, follow the instructions in [Implement a graph tool](/engine/6000.7/manual/extending-the-editor/gtk-index/implementing-a-graph-tool/implement-a-graph-tool.md).

## Implement a context node

To implement a context node, define a class that inherits from the `ContextNode` base class:

```csharp
[Serializable]
        public class MyContextNode : ContextNode
        {
        }

        #endregion MyContextNode

        #region MyBlockNode

        [UseWithContext(typeof(MyContextNode))]
        [Serializable]
        public class MyBlockNode : BlockNode
        {
        }

        #endregion MyBlockNode

        [Serializable]
        public class MyOtherContextNode : ContextNode
        {
        }

        #region MyBlockNodeWithMultipleContexts

        [UseWithContext(typeof(MyContextNode), typeof(MyOtherContextNode))]
        [Serializable]
        public class MyBlockNodeWithMultipleContexts : BlockNode
        {
        }

        #endregion MyBlockNodeWithMultipleContexts
    }
}
```

Review [Implement a node](/engine/6000.7/manual/extending-the-editor/gtk-index/implementing-a-graph-tool/implement-nodes.md) to learn how to customize the node with node options, ports, and orientation settings.

## Additional resources

* [ContextNode API reference](/engine/6000.7/script-reference/unity/graphtoolkit/editor/contextnode.md)
* [Implement a graph tool](/engine/6000.7/manual/extending-the-editor/gtk-index/implementing-a-graph-tool/implement-a-graph-tool.md)
* [About nodes](/engine/6000.7/manual/extending-the-editor/gtk-index/implementing-a-graph-tool/node-introduction.md)
* [Implement a node](/engine/6000.7/manual/extending-the-editor/gtk-index/implementing-a-graph-tool/implement-nodes.md)
* [Implement block nodes for your graph tool](/engine/6000.7/manual/extending-the-editor/gtk-index/implementing-a-graph-tool/implement-block-nodes.md)
