How to make a node based editor in Unity

I was wondering what’s (generally) involved in constructing a node based tool for Unity such as Strumpy Shader Editor?

Is it entirely built using the Unity Editor classes? or would I need to code something in C++ or access the Unity codebase itself?

Thanks for any insight!

Here is a minimal example for the GUI:

http://forum.unity3d.com/threads/189230-Simple-node-editor

You would exclusively use managed code, so yes, it’s just build with Unity’s GUI system.

The question can’t be straight answered, it’s too general. It depends on many things how you would design the structure:

  • How do you want to store / serialize the data that is going to be edited?
  • You would probably create an EditorWindow for the editor, so most functionality would be in OnGUI.
  • You should have a great understanding of the GUI system (Event class, keyboard focus, ControlID, …). You can use a .NET reflector to take a look into the UnityEngine.dll to see how the GUI controls are built.
  • For low-level drawing you could use the GL class

Besides that it’s just up to you. To follow OOP rules you might want to create a base class and / or some common interfaces for message processing between “nodes” / elements.

There’s nothing you can’t build with Unity :wink:

I came across this project which may be of interest to you and others.

http://forum.unity3d.com/threads/121708-The-Spaghetti-Machine-A-generic-graph-editor-RELEASED-v1.11

I haven’t used it so I can’t vouch for its quality or usability but it seems like a neat project.