-
Notifications
You must be signed in to change notification settings - Fork 36
Node Methods
Nodes that are connected to an output port will execute that node's OnRequestValue. This method contains the bulk of your implementation logic for your node.
Use GetInputValue() to retrieve the value of one of your input ports from its connection(s). If there are no connections to that input it will fallback to the value in the second argument - which is typically the associated field that we expose in the editor.
float a = GetInputValue("a", this.a);If you have multiple output ports, you will want to conditionally run logic per port:
public override object OnRequestValue(Port port)
{
switch (port.Name) {
case "b":
// Logic for output port a
case "a":
// Logic for output port b
}
}Called when the Graph's ScriptableObject gets the OnEnable message or when the node is added to the graph via Graph.AddNode().
Called when the Graph's ScriptableObject gets the OnDisable message or when the node is removed from the graph via Graph.RemoveNode()
Called in the editor when the node or graph is revalidated. This can happen in the following scenarios:
- The value is changed in the editor for one of the Node's
[Input]fields -
ScriptableObject.OnValidateis executed on the graph - each node will also get anOnValidatemessage after the Graph executesOnGraphValidate - An edge is added or removed from one of the ports
Called after this node is added to the graph via Graph.AddNode and before Node.OnEnable is called.
Called before this node is removed from a graph via Graph.RemoveNode and after Node.OnDisable is called.
Called when the Node.Error property value changes.