docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ContextNode

    A specialized node that serves as a dynamic container for compatible BlockNode instances.

    Inheritance
    object
    Node
    ContextNode
    Implements
    INode
    Inherited Members
    Node.OnEnable()
    Node.OnDisable()
    Node.DefineNode()
    Node.OnDefineOptions(Node.IOptionDefinitionContext)
    Node.OnDefinePorts(Node.IPortDefinitionContext)
    Node.nodeOptionCount
    Node.GetNodeOption(int)
    Node.nodeOptions
    Node.GetNodeOptionByName(string)
    Node.inputPortCount
    Node.GetInputPort(int)
    Node.GetInputPorts()
    Node.GetInputPortByName(string)
    Node.outputPortCount
    Node.GetOutputPort(int)
    Node.GetOutputPorts()
    Node.GetOutputPortByName(string)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.GraphToolkit.Editor
    Assembly: Unity.GraphToolkit.Editor.dll
    Syntax
    [Serializable]
    public abstract class ContextNode : Node, INode
    Remarks

    Context nodes are node structures that group and control a sequence of BlockNode instances. A ContextNode owns a list of BlockNodes. These blocks cannot exist independently in the graph and must always be children of a context node.

    To control which block node types are valid for a specific context node type, use the UseWithContextAttribute on the corresponding BlockNode class.

    Properties

    blockCount

    The number of BlockNodes contained in this context node.

    Declaration
    public int blockCount { get; }
    Property Value
    Type Description
    int
    Remarks

    The block count reflects the number of block nodes currently managed by the context node. This value may change dynamically as blocks are added or removed.

    blockNodes

    An IEnumerable collection of the BlockNodes contained in this context node.

    Declaration
    public IEnumerable<BlockNode> blockNodes { get; }
    Property Value
    Type Description
    IEnumerable<BlockNode>
    Remarks

    The returned collection reflects the current order and content of the context's block list.

    Methods

    GetBlock(int)

    Retrieves the BlockNode at the specified index in the context node's block list.

    Declaration
    public BlockNode GetBlock(int index)
    Parameters
    Type Name Description
    int index

    The zero-based index of the block to retrieve.

    Returns
    Type Description
    BlockNode

    The BlockNode at the specified index.

    Remarks

    The index is zero-based and corresponds to the block’s position within blockNodes.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown if the index is less than 0 or greater than or equal to the blockCount.

    Implements

    INode
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)