public void OnBeginDrag(PointerEventData eventData)
 {
     if (port.IsOutput)
     {
         tempConnection = Instantiate(graph.runtimeConnectionPrefab);
         tempConnection.transform.SetParent(graph.scrollRect.content);
         tempConnection.SetPosition(transform.position, eventData.position);
         startPos  = transform.position;
         startPort = port;
     }
     else
     {
         if (port.IsConnected)
         {
             NodePort output = port.Connection;
             Debug.Log("has " + port.ConnectionCount + " connections");
             Debug.Log(port.GetConnection(0));
             UGUIMathBaseNode otherNode     = graph.GetRuntimeNode(output.node);
             UGUIPort         otherUGUIPort = otherNode.GetPort(output.fieldName);
             Debug.Log("Disconnect");
             output.Disconnect(port);
             tempConnection = Instantiate(graph.runtimeConnectionPrefab);
             tempConnection.transform.SetParent(graph.scrollRect.content);
             tempConnection.SetPosition(otherUGUIPort.transform.position, eventData.position);
             startPos  = otherUGUIPort.transform.position;
             startPort = otherUGUIPort.port;
             graph.GetRuntimeNode(node).UpdateGUI();
         }
     }
 }
        public void OnDrag(PointerEventData eventData)
        {
            if (tempConnection == null)
            {
                return;
            }
            UGUIPort otherPort = FindPortInStack(eventData.hovered);

            tempHovered = otherPort;
            tempConnection.SetPosition(startPos, eventData.position);
        }
 public UGUIPort FindPortInStack(List <GameObject> stack)
 {
     for (int i = 0; i < stack.Count; i++)
     {
         UGUIPort port = stack[i].GetComponent <UGUIPort>();
         if (port)
         {
             return(port);
         }
     }
     return(null);
 }