private void ClearGraph(DialogueContainer container) { foreach (Node node in targetGraphView.nodes.ToList()) { // If the entry node, reset the GUID and continue. if (node is EntryNode entry) { entry.Guid = container.entryNode.guid; entry.SetPosition(new Rect(container.entryNode.position, BaseNode.DefaultNodeSize)); } else // disconnect the node, then remove the node. { Edges.Where(edge => edge.input.node == node).ToList() .ForEach(edge => targetGraphView.RemoveElement(edge)); targetGraphView.RemoveElement(node); } } }