using UnityEngine; namespace Unity.VisualScripting { [UnitCategory("Graphs/Graph Nodes")] public abstract class GetGraph : Unit where TGraph : class, IGraph, new() where TGraphAsset : Macro where TMachine : Machine { /// /// The GameObject to retrieve the graph from. /// [DoNotSerialize] [PortLabelHidden] [NullMeansSelf] public ValueInput gameObject { get; protected set; } /// /// The graph that is set on the GameObject. /// [DoNotSerialize] [PortLabel("Graph")] [PortLabelHidden] public ValueOutput graphOutput { get; protected set; } protected override void Definition() { gameObject = ValueInput(nameof(gameObject), null).NullMeansSelf(); graphOutput = ValueOutput(nameof(graphOutput), Get); } TGraphAsset Get(Flow flow) { var go = flow.GetValue(gameObject); return go.GetComponent().nest.macro; } } }