Convert Figma logo to code with AI

Seneral logoNode_Editor_Framework

A flexible and modular Node Editor Framework for creating node based displays and editors in Unity

2,010
414
2,010
14

Top Related Projects

9,978

JavaScript framework for visual programming

A graph node engine and editor written in Javascript similar to PD or UDK Blueprints, comes with its own editor in HTML5 Canvas2D. The engine can run client side or server side using Node. It allows to export graphs as JSONs to be included in applications independently.

Simple flow library 🖥️🖱️

5,633

🚀 JavaScript diagramming library that uses SVG and HTML for rendering.

Quick Overview

Node_Editor_Framework is a Unity3D framework for creating node-based editors and graphs. It provides a flexible and customizable system for building node-based interfaces, which can be used for visual scripting, dialogue trees, behavior trees, and other graph-based applications within Unity projects.

Pros

  • Highly customizable and extensible framework for creating node-based editors
  • Supports runtime node graphs, allowing for dynamic creation and modification of graphs during gameplay
  • Includes a variety of built-in node types and the ability to create custom nodes
  • Provides a user-friendly interface with features like zooming, panning, and node connection management

Cons

  • Limited documentation and examples, which may make it challenging for beginners to get started
  • Some reported issues with compatibility across different Unity versions
  • Lack of recent updates or active maintenance (as of the last check)
  • May require additional work to integrate with specific Unity systems or third-party assets

Code Examples

  1. Creating a basic node:
public class MyNode : Node 
{
    [Input] public float inputValue;
    [Output] public float outputValue;

    protected override void NodeGUI()
    {
        GUILayout.Label("My Custom Node");
        outputValue = inputValue * 2;
    }
}
  1. Registering a custom node:
[NodeCanvasType("MyCanvas")]
public class MyNodeCanvas : NodeCanvas
{
    protected override void OnCreate()
    {
        canvasType = "MyCanvas";
        Traversal = new MyCanvasCalculator();
    }
}

NodeTypes.FetchNodeTypes(typeof(MyNode));
  1. Accessing node data at runtime:
public class NodeGraphRunner : MonoBehaviour
{
    public NodeCanvas canvas;

    void Start()
    {
        NodeOutput output = canvas.CalculateCanvas(new NodeInput());
        Debug.Log("Output: " + output.ToString());
    }
}

Getting Started

  1. Clone the repository or download the latest release.
  2. Import the Node_Editor_Framework folder into your Unity project.
  3. Create a new script that inherits from NodeCanvas to define your custom canvas.
  4. Create custom node scripts by inheriting from Node and implementing the NodeGUI method.
  5. Use the NodeEditorWindow to create and edit your node graphs in the Unity editor.
  6. To use the graphs at runtime, add a NodeCanvas component to a GameObject and assign your created graph asset.

Competitor Comparisons

9,978

JavaScript framework for visual programming

Pros of Rete

  • More active development and larger community support
  • Extensive documentation and examples available
  • Built-in support for Vue.js integration

Cons of Rete

  • Steeper learning curve for beginners
  • Less flexibility in customizing the core functionality
  • Heavier dependency on external libraries

Code Comparison

Node_Editor_Framework:

public class Node : ScriptableObject
{
    public string name;
    public List<NodePort> Inputs = new List<NodePort>();
    public List<NodePort> Outputs = new List<NodePort>();
}

Rete:

import { Component } from 'rete';

class MyNode extends Component {
    constructor() {
        super("My Node");
        this.addInput(new Rete.Input('num', "Number", numSocket));
        this.addOutput(new Rete.Output('result', "Result", numSocket));
    }
}

Summary

Node_Editor_Framework is a Unity-based node editor framework, while Rete is a JavaScript-based modular framework for visual programming. Rete offers more active development and better documentation, but may be more complex for beginners. Node_Editor_Framework provides more flexibility in core customization but has a smaller community. The choice between the two depends on the specific project requirements and the developer's familiarity with the respective ecosystems.

A graph node engine and editor written in Javascript similar to PD or UDK Blueprints, comes with its own editor in HTML5 Canvas2D. The engine can run client side or server side using Node. It allows to export graphs as JSONs to be included in applications independently.

Pros of litegraph.js

  • Lightweight and easy to integrate into web applications
  • Supports both canvas and WebGL rendering for better performance
  • Extensive documentation and examples available

Cons of litegraph.js

  • Limited built-in node types compared to Node_Editor_Framework
  • Less customizable in terms of visual appearance
  • Primarily focused on web-based applications, limiting desktop use

Code Comparison

Node_Editor_Framework (C#):

public class ExampleNode : Node
{
    [Input] public float inputValue;
    [Output] public float outputValue;

    protected override void NodeGUI()
    {
        outputValue = inputValue * 2;
    }
}

litegraph.js (JavaScript):

function MyNode()
{
    this.addInput("in", "number");
    this.addOutput("out", "number");
    this.properties = { factor: 2 };
}

MyNode.prototype.onExecute = function()
{
    var input = this.getInputData(0);
    this.setOutputData(0, input * this.properties.factor);
}

LiteGraph.registerNodeType("basic/mynode", MyNode);

Both frameworks allow for easy creation of custom nodes, but Node_Editor_Framework uses C# attributes for inputs and outputs, while litegraph.js relies on method calls. litegraph.js also requires explicit node registration.

Simple flow library 🖥️🖱️

Pros of Drawflow

  • Lightweight and easy to integrate into web applications
  • Built with modern JavaScript (ES6+) and no dependencies
  • Supports mobile devices with touch interactions

Cons of Drawflow

  • Less feature-rich compared to Node_Editor_Framework
  • Limited customization options for node appearance
  • Smaller community and fewer examples available

Code Comparison

Node_Editor_Framework:

public class NodeCanvas : ScriptableObject {
    public List<Node> nodes = new List<Node>();
    public List<ConnectionPort> connections = new List<ConnectionPort>();
}

Drawflow:

class Drawflow {
  constructor(container) {
    this.drawflow = { drawflow: { Home: { data: {} } } };
    this.container = container;
  }
}

Both frameworks use different approaches to represent the node graph structure. Node_Editor_Framework uses a more object-oriented approach with separate classes for nodes and connections, while Drawflow uses a simpler JavaScript object structure to represent the entire graph.

Node_Editor_Framework is built for Unity and uses C#, offering deeper integration with the Unity ecosystem. Drawflow, on the other hand, is a standalone JavaScript library that can be easily integrated into web applications without additional dependencies.

Drawflow's simplicity makes it easier to get started with, but Node_Editor_Framework offers more advanced features and customization options for complex node-based editors in Unity projects.

5,633

🚀 JavaScript diagramming library that uses SVG and HTML for rendering.

Pros of X6

  • More active development with frequent updates and releases
  • Extensive documentation and examples available
  • Supports a wider range of graph types and use cases

Cons of X6

  • Steeper learning curve due to its comprehensive feature set
  • Larger file size and potentially higher performance overhead
  • Less focused on node-based editing specifically

Code Comparison

X6:

import { Graph } from '@antv/x6';

const graph = new Graph({
  container: document.getElementById('container'),
  width: 800,
  height: 600,
});

Node_Editor_Framework:

using NodeEditorFramework;

NodeEditorWindow window = new NodeEditorWindow();
NodeEditor.ClientRect = new Rect(0, 0, 800, 600);
window.Show();

Summary

X6 is a more comprehensive graph visualization library with broader applications, while Node_Editor_Framework is specifically tailored for node-based editing in Unity. X6 offers more features and active development but may be more complex to implement. Node_Editor_Framework provides a simpler, more focused solution for Unity developers but with potentially fewer features and less frequent updates.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Notice of Deprecation

Since I haven't personally used Unity in many years, and nobody came forward to fix it themselves, the project is currently in a broken state. Namely UndoPro, a dependency also developed by me, needs minor updates due to internal changes by Unity. I do not have the time anymore to dedicate to the project myself, and so unless someone comes forth to at least maintain it, I would recommend to look for another solution. This should be easy, since the creation of the project a lot of alternatives (and even an official solution) have been developed.

Node Editor Framework for Unity

A flexible and modular Node Editor Framework for creating node based displays and editors


Node Editor Image

WebGL Demo - Forum Thread - Documentation

Features

  • Extensible interface
  • Extensive controls including zooming/panning
  • Runtime-fetching of custom nodes, connections, canvas, traversal routines and controls
  • Full Save- and cache system (Scene, Asset and XML)
  • Runtime support (see WebGL demo)
  • Full Undo support using UndoPro (editor only)

Installation

Distribution Version

The LTS distribution version is just the base framework, intended to be installed as a package using the Unity Package Manager and used by different tools simultaneously, without any framework modifications by individual tools. With the options the framework gives, this still allows custom windows for each tool with custom look and behaviour. This is recommended for smaller tools that are released as a UPM package or through github with installation instructions. However it prevents you from using the Node Editor at runtime (see RTNodeEditor).
For detailed installation instructions see the latest LTS release.

  1. Install Undo Pro:
    UPM/Add from git (latest): https://github.com/Seneral/UndoPro.git#release-pkg
  2. Install Node Editor Framework:
    UPM/Add from git (latest): https://github.com/Seneral/Node_Editor_Framework.git#release-pkg

Development Version

This is intended to be used in tools aiming to modify the framework core and embed the framework in their distribution. This requires them to modify the namespace and make sure it does not conflict with other tools. This is the version to choose for Asset Store releases, as they cannot specify a UPM package as dependency.
For the development version, take the latest release from develop.

Examples

Examples can be found in the Examples subfolder or packaged in the latest LTS release.
In addition to those there are several other examples that are more involved, found as branches in this repo.

  1. The Texture Composer, as seen in the title screen, is a very simple setup of a few texture nodes built upon the default calculation canvas in the framework. Start here to get a basic idea on how to create simple extensions of the framework with custom functionality.
  2. A great, but complex example is the Dialogue System, developed and maintained by ChicK00o and atrblizzard. Making excellent use of the framework's modularity to extend the frameworks capability and behaviour to get a basic dialogue system, including the editing and runtime execution (with an example scene), up and running. Check it out if you want to get an idea of a bigger setup expanding on the Node Editor Framework with custom rules.
  3. Another set of nodes is the 'Expression Node' example. These are a bit different as they use reflection to inject any type of variable into the framework, to convert or execute code on. It's main purpose is to show complex modifications of the Node Knobs and general extended use of the framework.
  4. A small example of extending the editor controls can be seen in the included Node Group. It contains custom controls to handle without modifying any framework code.

Contributing

If you want to contribute to this framework or have improved this framework internally to suit your needs better, please consider creating a Pull Request with your changes when they could help the framework become better. The issues section serves as a feature discussion forum and I encourage you to check it out to get an idea of the future plans for the framework. You can also PM the main developer Seneral directly if you wish so.

Credits

The project was started as a part of the thread "Simple Node Editor" in may 2015 by Seneral. Big thanks to Baste Nesse Buanes who helped to set up this repository initially, without his help the framework could not have expanded to the point where it is now! Also, thanks to Vexe, who has greatly helped with the reflection related stuff which is used for the zooming functionality of the editor. And of course thanks to everyone contributing or simply motivating the developers by sharing their work with the Node Editor Framework! You can find the full list of contributors here.

Licensing

The license used is the MIT License - see license.md