From a6f0c9737af93edf1cb5a6c32f3c5e7496cd94eb Mon Sep 17 00:00:00 2001 From: MowfaqAlarbi <54871067+MowfaqAlarbi@users.noreply.github.com> Date: Wed, 4 Sep 2019 16:45:48 +0200 Subject: [PATCH] Update NodeGraphEditor.cs --- Scripts/Editor/NodeGraphEditor.cs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/Scripts/Editor/NodeGraphEditor.cs b/Scripts/Editor/NodeGraphEditor.cs index ad65552..f17f6ab 100644 --- a/Scripts/Editor/NodeGraphEditor.cs +++ b/Scripts/Editor/NodeGraphEditor.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using UnityEditor; @@ -42,7 +42,7 @@ namespace XNodeEditor { } /// Add items for the context menu when right-clicking this node. Override to add custom menu items. - public virtual void AddContextMenuItems(GenericMenu menu, GenericMenu.MenuFunction2 call = default(GenericMenu.MenuFunction2)) { + public virtual void AddContextMenuItems(GenericMenu menu) { Vector2 pos = NodeEditorWindow.current.WindowToGridPosition(Event.current.mousePosition); for (int i = 0; i < NodeEditorReflection.nodeTypes.Length; i++) { Type type = NodeEditorReflection.nodeTypes[i]; @@ -51,15 +51,9 @@ namespace XNodeEditor { string path = GetNodeMenuName(type); if (string.IsNullOrEmpty(path)) continue; - if(call != null) - menu.AddItem(new GUIContent(path), false, () => { - CreateNode(type, pos); - call(null); - }); - else - menu.AddItem(new GUIContent(path), false, () => { - CreateNode(type, pos); - }); + menu.AddItem(new GUIContent(path), false, () => { + CreateNode(type, pos); + }); } menu.AddSeparator(""); if (NodeEditorWindow.copyBuffer != null && NodeEditorWindow.copyBuffer.Length > 0) menu.AddItem(new GUIContent("Paste"), false, () => NodeEditorWindow.current.PasteNodes(pos)); @@ -136,4 +130,4 @@ namespace XNodeEditor { } } } -} \ No newline at end of file +}