![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Void |
Right now, I’m working on a dialog editor using GraphEdit/GraphNode, but I’ve hit an issue with deleting nodes that have connections.
I have a graph setup like so:
When the close button is pressed, the following code runs on the graph:
var node_to_delete = graph.get_node(name)
graph.remove_child(node_to_delete)
node_to_delete.queue_free()
It has to be run on the graph and not the actual node so that UndoRedo works with the setup. However, when the node is deleted, the connections are left behind:
The same issue occurs if I only remove the node as a child of the graph, or just queue_free it.
The next time the graph refreshes (via scrolling, zooming in, or adding another node), these connections all disappear, and the debugger says that it can’t find the deleted node.
How am I supposed to properly remove a GraphNode from a scene? The visual shader editor doesn’t have this issue, so there has to be a proper way of doing it that doesn’t have this error.
I’m using Godot 3.1.1 stable, on Linux Mint 19.2.