private void HandleContextMenu(Event e) { bool isContextClick = (e.button == 1 && e.type == EventType.MouseUp) || (e.control && e.type == EventType.MouseUp); if (Graph.AllowClick && isContextClick) { if (Graph.multiSelection.Count > 1) { } else { var menu = new GenericMenu(); menu.AddSeparator("/"); menu.AddItem(new GUIContent("删除"), false, () => { graph.RemoveNode(this); //这里还需判断是否存在脚本 if (this.ScriptObject != null) { EditorTool.DeleteScript(this.ScriptObject); AssetDatabase.Refresh(); } }); Graph.PostGUI += () => { menu.ShowAsContext(); }; e.Use(); } } }