diff --git a/Scripts/Editor/NodeEditorAction.cs b/Scripts/Editor/NodeEditorAction.cs
index 7b43574..c1f7a40 100644
--- a/Scripts/Editor/NodeEditorAction.cs
+++ b/Scripts/Editor/NodeEditorAction.cs
@@ -159,6 +159,8 @@ namespace XNodeEditor {
currentActivity = NodeActivity.Idle;
} else if (e.button == 1) {
if (!isPanning) {
+ if (IsHoveringPort)
+ ShowPortContextMenu(hoveredPort);
if (IsHoveringNode && IsHoveringTitle(hoveredNode)) {
if (!Selection.Contains(hoveredNode)) SelectNode(hoveredNode, false);
ShowNodeContextMenu();
diff --git a/Scripts/Editor/NodeEditorGUI.cs b/Scripts/Editor/NodeEditorGUI.cs
index 4db162b..f5fd919 100644
--- a/Scripts/Editor/NodeEditorGUI.cs
+++ b/Scripts/Editor/NodeEditorGUI.cs
@@ -87,6 +87,14 @@ namespace XNodeEditor {
return GUILayout.Button(name, EditorStyles.toolbarDropDown, GUILayout.Width(width));
}
+ /// Show right-click context menu for hovered port
+ void ShowPortContextMenu(XNode.NodePort hoveredPort) {
+ GenericMenu contextMenu = new GenericMenu();
+ contextMenu.AddItem(new GUIContent("Clear Connections"), false, () => hoveredPort.ClearConnections());
+ contextMenu.DropDown(new Rect(Event.current.mousePosition, Vector2.zero));
+ AssetDatabase.SaveAssets();
+ }
+
/// Show right-click context menu for selected nodes
public void ShowNodeContextMenu() {
GenericMenu contextMenu = new GenericMenu();
diff --git a/Scripts/Node.cs b/Scripts/Node.cs
index ddc43ea..099c56e 100644
--- a/Scripts/Node.cs
+++ b/Scripts/Node.cs
@@ -127,7 +127,7 @@ namespace XNode {
}
/// Removes all instance ports from the node
- [ContextMenu("Clear instance ports")]
+ [ContextMenu("Clear Instance Ports")]
public void ClearInstancePorts() {
List instancePorts = new List(InstancePorts);
foreach (NodePort port in instancePorts) {