Closed snarlynarwhal closed 8 years ago
You need to build a 3rd editor script anywhere that subscribes to these events. So you'd do NodeEditorFramework.NodeEditorCallbacks.OnNodeMove += MyCallbackMethod
Hope that helps!
I can't seem to get it working, here's my code:
I added a Debug.Log in the OnEnable function, but got nothing. o.0 I haven't dealt with subscribing or delegates before, and have dabbled very little in editor scripts so I'm a novice to this.
ps - I owe you for all the help. So I'll definitely be contributing a feature or two to the project soon. :)
Finally got it working but adding this line:
[CustomEditor(typeof(MachineNode))]
However, it keeps adding the connection OnEnable (duh). I added a static bool to track whether or not I've subscribed to the delegate. It appears to work fine! Or would there be a better place to subscribe?
Sorry, was unavailable. Yes for it to execute you need to make it a custom editor (in this case).
For delegates, I tend to first unsubscribe (-=) and then subscribe (+=). If you haven't subsribed before it will do nothing but if you did you won't have duplicate subscribers:)
No worries! And ahh got it thanks! :D
I'm using the Node Editor as tool to modify/move/add/remove components in the Editor (not in play mode). I'd imagine that I want to use the NodeEditorCallbacks class and not the NodeEditorCallbackReceiver one. I understand how to implement the second method, but not the prior. Any examples anywhere?