No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GetGraph.cs 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using UnityEngine;
  2. namespace Unity.VisualScripting
  3. {
  4. [UnitCategory("Graphs/Graph Nodes")]
  5. public abstract class GetGraph<TGraph, TGraphAsset, TMachine> : Unit
  6. where TGraph : class, IGraph, new()
  7. where TGraphAsset : Macro<TGraph>
  8. where TMachine : Machine<TGraph, TGraphAsset>
  9. {
  10. /// <summary>
  11. /// The GameObject to retrieve the graph from.
  12. /// </summary>
  13. [DoNotSerialize]
  14. [PortLabelHidden]
  15. [NullMeansSelf]
  16. public ValueInput gameObject { get; protected set; }
  17. /// <summary>
  18. /// The graph that is set on the GameObject.
  19. /// </summary>
  20. [DoNotSerialize]
  21. [PortLabel("Graph")]
  22. [PortLabelHidden]
  23. public ValueOutput graphOutput { get; protected set; }
  24. protected override void Definition()
  25. {
  26. gameObject = ValueInput<GameObject>(nameof(gameObject), null).NullMeansSelf();
  27. graphOutput = ValueOutput(nameof(graphOutput), Get);
  28. }
  29. TGraphAsset Get(Flow flow)
  30. {
  31. var go = flow.GetValue<GameObject>(gameObject);
  32. return go.GetComponent<TMachine>().nest.macro;
  33. }
  34. }
  35. }