private void GenerateNodesFromData() { Dictionary <DataGraphNode, Node> nodeMap = new Dictionary <DataGraphNode, Node>(); data.nodes.ForEach((DataGraphNode n) => { nodeMap.Add(n, OnClickAddNode(n.uiSettings.rect.position, n)); }); if (nodes != null) { nodes.ForEach((Node n) => { List <DataGraphNode> dataNodeConnections = data.GetNodeConnections(n.dataNode); dataNodeConnections.ForEach((DataGraphNode c) => { if (connections == null) { connections = new List <Connection>(); } connections.Add(new Connection( nodeMap[c].inPoint, n.outPoint, OnClickRemoveConnection )); }); }); } }