private void GetCustomNode()
 {
     baseNode = this.gameObject.GetComponentInParent <UGUIBaseNode>();
     if (baseNode.node is IUGUIDynamicListNode)
     {
         dynamicNode = (IUGUIDynamicListNode)baseNode.node;
     }
 }
    public void SpawnGraph()
    {
        if (nodes != null)
        {
            nodes.Clear();
        }
        else
        {
            nodes = new List <IUGUINode>();
        }

        if (graph == null)
        {
            return;
        }

        for (int i = 0; i < graph.nodes.Count; i++)
        {
            Node node = graph.nodes[i];

            if (node == null)
            {
                continue;
            }

            UGUIBaseNode runtimeNode = null;

            runtimeNode = Instantiate(nodePrefab);

            runtimeNode.transform.SetParent(scrollRect.content);
            runtimeNode.node  = node;
            runtimeNode.graph = this;
            runtimeNode.transform.localPosition = new Vector2(node.position.x, -node.position.y);
            runtimeNode.transform.localScale    = Vector3.one;
            runtimeNode.name = node.GetType().Name;

            runtimeNode.SetColor();

            runtimeNode.gameObject.SetActive(true);

            nodes.Add(runtimeNode);
        }

        if (graph is NTGraph)
        {
            NTGraph gnt = (NTGraph)graph;

            if (gnt.packedNodes == null)
            {
                gnt.packedNodes = new List <NodeGroupGraph>();
            }

            foreach (var extra in gnt.packedNodes)
            {
                UGUIGroupedNode runtimeNode = null;

                runtimeNode = Instantiate(groupedNodePrefab);

                runtimeNode.transform.SetParent(scrollRect.content);
                runtimeNode.group = extra;
                runtimeNode.graph = this;
                runtimeNode.transform.localPosition = new Vector2(extra.position.x, -extra.position.y);
                runtimeNode.transform.localScale    = Vector3.one;
                runtimeNode.name = "Extra thing????";

                runtimeNode.GetComponent <Image>().color = Color.green;
                runtimeNode.gameObject.SetActive(true);
                nodes.Add(runtimeNode);
            }
        }
    }