private void OnClickAddNode(Vector2 mousePosition)
    {
        if (nodes == null)
        {
            nodes = new List <Node>();
        }

        Rect _rect = new Rect(mousePosition.x, mousePosition.y, nodeWidth, nodeHeight);

        nodes.Add(new Node(_rect, nodeStyle, selectedNodeStyle, inPointStyle, outPointStyle, titleStyle, OnClickRemoveNode, this, (highestID + 1)));
        highestID++;

        GameObject nodeObject = new GameObject();

        nodeObject.name             = "Generated_Node_" + (highestID);
        nodeObject.tag              = "NarrativeTrigger";
        nodeObject.transform.parent = nodesParent.transform;

        nodeObject.AddComponent <BoxCollider>();
        nodeObject.AddComponent <TriggerNodeInfo>();

        nodeObject.GetComponent <BoxCollider>().size      = new Vector3(10, 10, 1);
        nodeObject.GetComponent <BoxCollider>().isTrigger = true;
        TriggerNodeInfo script = nodeObject.GetComponent <TriggerNodeInfo>();

        Node currentNode = nodes[nodes.Count - 1];

        script.SaveTriggerData(currentNode.rect, currentNode.ID, currentNode.title, currentNode.showAudio, currentNode.playedAudioClips, currentNode.delays, null, currentNode.pathType, currentNode.scrollViewVector, currentNode.worldPosition);
        sceneItems.Add(script);
    }
    private void SaveData()
    {
        foreach (Node _node in nodes)
        {
            TriggerNodeInfo script = sceneItems.Where(t => t.ID == _node.ID).First();
            GameObject      obj    = script.gameObject;
            obj.name = "Generated_Node_" + script.ID; //The name shows the node ID to make it easier.

            List <Vector2> v2Cons = null;

            if (_node.nodeCons.Count > 0)
            {
                v2Cons = new List <Vector2>();
                foreach (Connection con in _node.nodeCons)
                {
                    v2Cons.Add(new Vector2(con.inPoint.ID, con.outPoint.ID));
                }
            }

            script.SaveTriggerData(_node.rect, _node.ID, _node.title, _node.showAudio, _node.playedAudioClips, _node.delays, v2Cons, _node.pathType, _node.scrollViewVector, _node.worldPosition);
        }

        ConnectionsManager conManager = GetConnectionManager();

        List <ConnectionInfo> conList = new List <ConnectionInfo>();

        foreach (Connection con in connections)
        {
            conList.Add(new ConnectionInfo(con.inPoint.ID, con.outPoint.ID, con.connectionType));
        }

        conManager.SaveConnections(conList);

        //When the nodes and connections get saved, save the scene too to make sure everything is saved.
        string[] path = EditorSceneManager.GetActiveScene().path.Split(char.Parse("/"));
        path[path.Length - 1] = path[path.Length - 1];
        bool saveOK = EditorSceneManager.SaveScene(EditorSceneManager.GetActiveScene(), string.Join("/", path));

        Debug.Log("Saved the Nodes and the Scene " + (saveOK ? "Sucessfully" : "Error!"));
        nextSave = (float)EditorApplication.timeSinceStartup + saveTime;
    }