# Node

> The base class for all user-accessible nodes in a graph.

## Definition

* **Type:** Class
* **Namespace:** [Unity.GraphToolkit.Editor](/engine/6000.6/script-reference/unity/graphtoolkit/editor.md)
* **Assembly:** UnityEditor
* **Implements:** [INode](/engine/6000.6/script-reference/unity/graphtoolkit/editor/inode.md)

```csharp
public abstract class Node : INode
```

## Remarks

Inherit from this class to define custom node types that appear in the graph. The [Node](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node.md) class provides lifecycle hooks, serialization support, and the structure needed to define ports, UI behaviors, and custom logic. This class forms the foundation of all user-defined nodes in a graph-based tool, including variable nodes, context nodes, and subgraph nodes.

To create a custom node, derive from [Node](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node.md), define its input and output ports using a port builder in [Node.OnDefinePorts](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/ondefineports.md), and define its [INodeOption](/engine/6000.6/script-reference/unity/graphtoolkit/editor/inodeoption.md)s in [Node.OnDefineOptions](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/ondefineoptions.md).

This class is used in combination with other types like [INode](/engine/6000.6/script-reference/unity/graphtoolkit/editor/inode.md), [IPort](/engine/6000.6/script-reference/unity/graphtoolkit/editor/iport.md), and [Node.Graph](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/graph.md) to construct and manage node-based workflows.

Additional Resources: [INode](/engine/6000.6/script-reference/unity/graphtoolkit/editor/inode.md), [ContextNode](/engine/6000.6/script-reference/unity/graphtoolkit/editor/contextnode.md), [BlockNode](/engine/6000.6/script-reference/unity/graphtoolkit/editor/blocknode.md), [IVariableNode](/engine/6000.6/script-reference/unity/graphtoolkit/editor/ivariablenode.md), [ISubgraphNode](/engine/6000.6/script-reference/unity/graphtoolkit/editor/isubgraphnode.md)

## Properties

| Property                                                                                             | Description                                                                                                                                  |
| ---------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| [DefaultColor](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/defaultcolor.md)       | The highlight color of the node. The highlight is located on the upper border of nodes, and on the upper and lower borders of context nodes. |
| [FillAmount](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/fillamount.md)           | The progress fill amount displayed on the node's accent bar, expressed as a percentage.                                                      |
| [Graph](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/graph.md)                     | The [Node.Graph](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/graph.md) that contains this node.                           |
| [ID](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/id.md)                           | The globally unique identifier for this node.                                                                                                |
| [InputPortCount](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/inputportcount.md)   | The number of input ports on the node.                                                                                                       |
| [NodeOptionCount](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/nodeoptioncount.md) | The number of node options defined in the node.                                                                                              |
| [NodeOptions](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/nodeoptions.md)         | The node options defined on this node.                                                                                                       |
| [OutputPortCount](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/outputportcount.md) | The number of output ports on the node.                                                                                                      |
| [Position](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/position.md)               | The position of the node in the graph.                                                                                                       |
| [Subtitle](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/subtitle.md)               | The secondary text displayed in the node's header.                                                                                           |
| [Title](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/title.md)                     | The main text displayed in the node's header.                                                                                                |
| [Tooltip](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/tooltip.md)                 | The text displayed when hovering over the node's header.                                                                                     |

## Methods

| Method                                                                                                       | Description                                                                                                                                                     |
| ------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [DefineNode](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/definenode.md)                   | Defines the structure of the node by building its ports and options.                                                                                            |
| [GetInputPort](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/getinputport.md)               | Retrieves an input port using its index.                                                                                                                        |
| [GetInputPortByName](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/getinputportbyname.md)   | Retrieves an input port using its name.                                                                                                                         |
| [GetInputPorts](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/getinputports.md)             | Retrieves all input ports on the node in the order they are displayed.                                                                                          |
| [GetNodeOption](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/getnodeoption.md)             | Retrieves a node option using its zero-based index.                                                                                                             |
| [GetNodeOptionByName](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/getnodeoptionbyname.md) | Retrieves a node option using its name.                                                                                                                         |
| [GetOutputPort](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/getoutputport.md)             | Retrieves an output port using its index in the displayed order.                                                                                                |
| [GetOutputPortByName](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/getoutputportbyname.md) | Retrieves an output port using its name.                                                                                                                        |
| [GetOutputPorts](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/getoutputports.md)           | Retrieves all output ports on the node in the order they are displayed.                                                                                         |
| [OnDefineOptions](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/ondefineoptions.md)         | Called during [Node.DefineNode](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/definenode.md) to define the options available on the node.      |
| [OnDefinePorts](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/ondefineports.md)             | Called during [Node.DefineNode](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/definenode.md) to define the input and output ports of the node. |
| [OnDisable](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/ondisable.md)                     | Called when the node is removed or when the graph is disabled.                                                                                                  |
| [OnEnable](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/onenable.md)                       | Called when the node is created or when the graph is enabled.                                                                                                   |
| [RemoveFromGraph](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/removefromgraph.md)         | Removes the node from its graph.                                                                                                                                |

## Interfaces

| Interface                                                                                                                   | Description                                                                                                                                                                              |
| --------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Node.IOptionDefinitionContext](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/ioptiondefinitioncontext.md) | Interface that provides methods to declare node options inside a node.                                                                                                                   |
| [Node.IPortDefinitionContext](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/iportdefinitioncontext.md)     | Interface that provides methods to define input and output ports during [Node.OnDefinePorts](/engine/6000.6/script-reference/unity/graphtoolkit/editor/node/ondefineports.md) execution. |
