public bool OnSelectEntry(SearchTreeEntry entry, SearchWindowContext context) { if (!(entry is SearchTreeGroupEntry)) { if (!GraphViewStaticBridge.HasGUIView(graphView)) { return(false); } MathNode node = ScriptableObject.CreateInstance(entry.userData as Type) as MathNode; AddNode(node); Node nodeUI = CreateNode(node) as Node; if (nodeUI != null) { if (m_InsertStack != null) { MathStackNode stackNode = m_InsertStack.userData as MathStackNode; stackNode.InsertNode(m_InsertIndex, node); m_InsertStack.InsertElement(m_InsertIndex, nodeUI); } else { graphView.AddElement(nodeUI); Vector2 pointInWindow = context.screenMousePosition - position.position; Vector2 pointInGraph = nodeUI.parent.WorldToLocal(pointInWindow); nodeUI.SetPosition(new Rect(pointInGraph, Vector2.zero)); // it's ok to pass zero here because width/height is dynamic } nodeUI.Select(graphView, false); } else { Debug.LogError("Failed to create element for " + node); return(false); } return(true); } return(false); }