Skip to content

Custom Nodes

Mefodei edited this page Feb 18, 2020 · 2 revisions

Simple Custom Node

Define you own custom node is easy. All you need is create new class and extend UniNode base class

[CreateNodeMenu("Examples/SimpleCustomNodes/SimpleDemoNode",nodeName = "Simple Node")]
public class SimpleDemoNode: UniNode
{

}

After that your node would be look like

Hm...No so pretty as you imagine, i think. But now we can add several additional parameters to our node.

Define inspector

[CreateNodeMenu("Examples/SimpleCustomNodes/SimpleDemoNode",nodeName = "Simple Node")]
public class SimpleDemoNode: UniNode
{
    [SerializeField]
    private int intDataOne;
    
    public int intDataTwo;
    
}

But there is still no way to data connection. Let's fix that!

Define Node Ports

[CreateNodeMenu("Examples/SimpleCustomNodes/SimpleNode",nodeName = "Simple Node")]
public class SimpleDemoNode : UniNode
{

    [SerializeField]
    private int intDataOne;
    
    public int intDataTwo;

    [PortValue(PortIO.Input)]
    public int inInt;

    [PortValue(PortIO.Output)] 
    public float outInt;

}

Clone this wiki locally