Skip to content

Node.AddInstancePort

Thor Brigsted edited this page Jan 9, 2018 · 4 revisions

Add a dynamic, serialized output port to this node

public NodePort AddInstancePort(Type type, NodePort.IO direction, string fieldName = null);
Parameters Summary
type NodePort value type.
direction Whether this is an input or output port.
fieldName Unique identifier used to find this NodePort. Automatically assigns a unique name if null.

Instance ports are not automatically displayed on default node inspectors. To visually modify instance ports, create a custom node inspector for your node.

using UnityEngine;
using XNode;

public class ExampleNode : Node{

    [ContextMenu("Add instance output")]
    void AddPort() {
        NodePort port = AddInstancePort(typeof(float), NodePort.IO.Input);
        Debug.Log("Added new output port with name " + port.fieldName);
    }
}
Clone this wiki locally