Unity - Scripting API: SubgraphAttribute
class in Unity.GraphToolkit.Editor
Success!
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Submission failed
For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
Description
Attribute used to define a link between a subgraph type and a main graph type.
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 GraphOptions.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.
// This declares a subgraph type used by MyMainGraph [Subgraph(typeof(MyMainGraph))] public class MySubgraph : Graph
Properties
| Property | Description |
|---|---|
| MainGraphType | The type of the main Graph that supports this subgraph type. |
Constructors
| Constructor | Description |
|---|---|
| SubgraphAttribute | Initializes a new instance of the SubgraphAttribute class. |