I’m making a custom node editor in Unity to use as a base from which to make more specific editors for things like dialogue trees.
A key part of this editor is the ability to create connections between nodes, and also for the user to be able to modify these connections immediately, after they’re created.
To modify a connection, I’m using a Handle.Button with a circle cap that the user can click on, which calls a function that deletes the existing connection and starts a new one of the same connection type.
You can see what this looks like below. I’ve circled two Handle.Button 's in red for clarity:
These buttons work fine initially, but when the scene is saved and the custom assets that hold these connections are serialized and Unity then reloaded, these buttons become unresponsive. Only new connections are responsive, and even then, clicking one of the Handle buttons from these new connections deletes one of the unresponsive connections.
There’s too much code for me to chop out the relevant bits and paste them here, so here’s a link to the public GitHub repo that you should be able to pull the project from:
You can access the editor in Unity by going:
Window/Custom/NodeEditor.
The key scripts are the NodeConnection script, which is where the connections and Handle.Button circles are drawn:
Assets\NodeEditor\Scripts\NodeConnections
and the NodeEditor, which is the key Custom Editor script that handles most of what the editor does and looks like.
There’s a bit to look through, but I would massively appreciate any help because this has stumped me.
Thanks in advance,
Matt