docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class SubgraphAttribute

    Attribute used to define a link between a subgraph type and a main graph type.

    Inheritance
    object
    Attribute
    SubgraphAttribute
    Implements
    _Attribute
    Inherited Members
    Attribute.Equals(object)
    Attribute.GetCustomAttribute(Assembly, Type)
    Attribute.GetCustomAttribute(Assembly, Type, bool)
    Attribute.GetCustomAttribute(MemberInfo, Type)
    Attribute.GetCustomAttribute(MemberInfo, Type, bool)
    Attribute.GetCustomAttribute(Module, Type)
    Attribute.GetCustomAttribute(Module, Type, bool)
    Attribute.GetCustomAttribute(ParameterInfo, Type)
    Attribute.GetCustomAttribute(ParameterInfo, Type, bool)
    Attribute.GetCustomAttributes(Assembly)
    Attribute.GetCustomAttributes(Assembly, bool)
    Attribute.GetCustomAttributes(Assembly, Type)
    Attribute.GetCustomAttributes(Assembly, Type, bool)
    Attribute.GetCustomAttributes(MemberInfo)
    Attribute.GetCustomAttributes(MemberInfo, bool)
    Attribute.GetCustomAttributes(MemberInfo, Type)
    Attribute.GetCustomAttributes(MemberInfo, Type, bool)
    Attribute.GetCustomAttributes(Module)
    Attribute.GetCustomAttributes(Module, bool)
    Attribute.GetCustomAttributes(Module, Type)
    Attribute.GetCustomAttributes(Module, Type, bool)
    Attribute.GetCustomAttributes(ParameterInfo)
    Attribute.GetCustomAttributes(ParameterInfo, bool)
    Attribute.GetCustomAttributes(ParameterInfo, Type)
    Attribute.GetCustomAttributes(ParameterInfo, Type, bool)
    Attribute.GetHashCode()
    Attribute.IsDefaultAttribute()
    Attribute.IsDefined(Assembly, Type)
    Attribute.IsDefined(Assembly, Type, bool)
    Attribute.IsDefined(MemberInfo, Type)
    Attribute.IsDefined(MemberInfo, Type, bool)
    Attribute.IsDefined(Module, Type)
    Attribute.IsDefined(Module, Type, bool)
    Attribute.IsDefined(ParameterInfo, Type)
    Attribute.IsDefined(ParameterInfo, Type, bool)
    Attribute.Match(object)
    Attribute.TypeId
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.GraphToolkit.Editor
    Assembly: Unity.GraphToolkit.Editor.dll
    Syntax
    public sealed class SubgraphAttribute : Attribute, _Attribute
    Remarks

    Apply this attribute to a custom Graph class to declare it as a valid subgraph type for a specific parent (main) graph type. This attribute is required when you want to designate a specific graph type to function as a subgraph in tools that support subgraphs.

    Use it on custom graph classes that are designed to act as subgraphs. This is useful when you want to provide specialized subgraph behaviors, customize the user experience, or restrict subgraph usage to certain graph types.

    When a graph type declares that it supports subgraphs using SupportsSubgraphs but no corresponding SubgraphAttribute is found, the main graph type itself is used as the subgraph type by default.

    You can associate multiple subgraph types with the same main graph type. In this case, the editor's context menu includes multiple "Create Subgraph class name Subgraph from Selection" actions—one for each valid subgraph type.

    Examples
    // This declares a subgraph type used by MyMainGraph
    [Subgraph(typeof(MyMainGraph))]
    public class MySubgraph : Graph

    Constructors

    SubgraphAttribute(Type)

    Initializes a new instance of the SubgraphAttribute class.

    Declaration
    public SubgraphAttribute(Type mainGraphType)
    Parameters
    Type Name Description
    Type mainGraphType

    The type of the main Graph that this subgraph type is compatible with. This must be a type that inherits from Graph.

    Remarks

    Use this constructor to associate a custom subgraph class with a parent graph type. This enables the graph tool to recognize the subgraph as a valid option for the specified main graph. The attribute must be applied to a Graph-derived class intended to function as a subgraph.

    Examples
    // This declares a subgraph type used by MyMainGraph
    [Subgraph(typeof(MyMainGraph))]
    public class MySubgraph : Graph

    Properties

    MainGraphType

    The type of the main Graph that supports this subgraph type.

    Declaration
    public Type MainGraphType { get; }
    Property Value
    Type Description
    Type

    Implements

    _Attribute
    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)