# AddOutputPort

> Adds a new output port with the specified name.

## Definition

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

## AddOutputPort(string)

Adds a new output port with the specified name.

```csharp
IOutputPortBuilder AddOutputPort(string portName)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The unique identifier of the output port.

### Returns

| Type                                                                                                  | Description                                                                                                                                    |
| ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| [IOutputPortBuilder](/engine/6000.5/script-reference/unity/graphtoolkit/editor/ioutputportbuilder.md) | An [IOutputPortBuilder](/engine/6000.5/script-reference/unity/graphtoolkit/editor/ioutputportbuilder.md) to further configure the output port. |

### Remarks

`portName` is used to identify the port. It must be unique among output ports on the node. This name is used as the ID when calling [Node.GetOutputPortByName](/engine/6000.5/script-reference/unity/graphtoolkit/editor/node/getoutputportbyname.md). If [IPortBuilder\<T>.WithDisplayName](/engine/6000.5/script-reference/unity/graphtoolkit/editor/iportbuilder1/withdisplayname.md) is not used, this name is also used as the port's display label.

**Warning**: Changing a port's name breaks any existing connections, because the name is used as the port's unique ID.

Use the returned builder to configure port properties and then call [IPortBuilder\<T>.Build()](/engine/6000.5/script-reference/unity/graphtoolkit/editor/iportbuilder1/build.md) to create the port.

### Examples

```csharp
var port = context.AddOutputPort("myOutput")
    .WithDisplayName("My Output Port")
    .WithDataType(typeof(float))
    .WithConnectorUI(PortConnectorUI.Arrowhead)
    .Build();
```

## AddOutputPort\<T>(string)

Adds a new typed output port with the specified name.

```csharp
IOutputPortBuilder<T> AddOutputPort<T>(string portName)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The unique identifier of the output port.

### Returns

| Type                                                                                                      | Description                                                                                                                                                   |
| --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [IOutputPortBuilder\<T>](/engine/6000.5/script-reference/unity/graphtoolkit/editor/ioutputportbuilder.md) | An [IOutputPortBuilder\<TData>](/engine/6000.5/script-reference/unity/graphtoolkit/editor/ioutputportbuilder1.md) to further configure the typed output port. |

### Remarks

`portName` is used to identify the port. It must be unique among output ports on the node. This name is used as the ID when calling [Node.GetOutputPortByName](/engine/6000.5/script-reference/unity/graphtoolkit/editor/node/getoutputportbyname.md). If [IPortBuilder\<T>.WithDisplayName](/engine/6000.5/script-reference/unity/graphtoolkit/editor/iportbuilder1/withdisplayname.md) is not used, this name is also used as the port's display label.

**Warning**: Changing a port's name breaks any existing connections, because the name is used as the port's unique ID.

Use the returned builder to configure port properties and then call [IPortBuilder\<T>.Build()](/engine/6000.5/script-reference/unity/graphtoolkit/editor/iportbuilder1/build.md) to create the port.

### Examples

```csharp
var port = context.AddOutputPort<bool>("boolOutput")
    .WithDisplayName("Boolean Output")
    .Build();
```
