Implement block nodes for your graph tool
Create block nodes to enhance the functionality of your graph tool in Unity.
阅读时间1 分钟最后更新于 25 天前
Create block nodes to define the functionality of the context nodes of your graph tool in Unity.
Block nodes are nodes that perform a single operation or behavior. Block nodes inherit all features available in their parent class.
NodeThis page covers how to implement block nodes only. For information on how to implement context nodes, refer to Implement context nodes for your graph tool. For information about node types, refer to About nodes.
Prerequisites
Implement a block node
To implement a block node, define a class to associate the block node with a context node.
- Define a class that inherits from the base class.
BlockNode - Add the attribute, and provide it with the type of the
UseWithContextto associate the block node with.ContextNode
The resulting code looks like:
[UseWithContext(typeof(MyContextNode))] [Serializable] public class MyBlockNode : BlockNode { } #endregion MyBlockNode [Serializable] public class MyOtherContextNode : ContextNode { } #region MyBlockNodeWithMultipleContexts [UseWithContext(typeof(MyContextNode), typeof(MyOtherContextNode))] [Serializable] public class MyBlockNodeWithMultipleContexts : BlockNode { } #endregion MyBlockNodeWithMultipleContexts }}
To associate a block node with several context nodes, list them separated with a comma in your attribute:
UseWithContext[UseWithContext(typeof(MyContextNode), typeof(MyOtherContextNode))] [Serializable] public class MyBlockNodeWithMultipleContexts : BlockNode { } #endregion MyBlockNodeWithMultipleContexts }}
Review Implement node options to learn how to customize your node with node options, ports, and orientation settings.