# Connect(IPort, IPort)

> Creates a wire connection between two ports.

## Definition

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

```csharp
public bool Connect(IPort output, IPort input)
```

### Parameters

**** (\[IPort]\(/engine/6000.6/script-reference/unity/graphtoolkit/editor/iport)): The output port to connect from.**** (\[IPort]\(/engine/6000.6/script-reference/unity/graphtoolkit/editor/iport)): The input port to connect to.

### Returns

| Type                                                          | Description                                                                  |
| ------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | true if the connection was created; false if the connection already existed. |

### Remarks

Enclose this method with [Graph.UndoBeginRecordGraph](/engine/6000.6/script-reference/unity/graphtoolkit/editor/graph/undobeginrecordgraph.md) and [Graph.UndoEndRecordGraph](/engine/6000.6/script-reference/unity/graphtoolkit/editor/graph/undoendrecordgraph.md) to add this operation to the undo stack and to update the graph view with the changes.
