# Disconnect(IPort, IPort)

> Removes the wire connection between two ports.

## Definition

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

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

### Parameters

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

### Returns

| Type                                                          | Description                                                                     |
| ------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | true if a connection (wire or portal) existed and was removed; otherwise false. |

### Remarks

This method removes direct wires and any Portals that serve only this specific connection. Enclose this method with [Graph.UndoBeginRecordGraph](/engine/6000.7/script-reference/unity/graphtoolkit/editor/graph/undobeginrecordgraph.md) and [Graph.UndoEndRecordGraph](/engine/6000.7/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.
