暫無描述
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.

123456789101112131415161718192021222324252627282930313233343536
  1. using UnityEngine;
  2. namespace Unity.VisualScripting
  3. {
  4. /// <summary>
  5. /// Returns the current game object.
  6. /// </summary>
  7. [SpecialUnit]
  8. [RenamedFrom("Bolt.Self")]
  9. [RenamedFrom("Unity.VisualScripting.Self")]
  10. public sealed class This : Unit
  11. {
  12. /// <summary>
  13. /// The current game object.
  14. /// </summary>
  15. [DoNotSerialize]
  16. [PortLabelHidden]
  17. [PortLabel("This")]
  18. public ValueOutput self { get; private set; }
  19. protected override void Definition()
  20. {
  21. self = ValueOutput(nameof(self), Result).PredictableIf(IsPredictable);
  22. }
  23. private GameObject Result(Flow flow)
  24. {
  25. return flow.stack.self;
  26. }
  27. private bool IsPredictable(Flow flow)
  28. {
  29. return flow.stack.self != null;
  30. }
  31. }
  32. }