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.

SaveVariables.cs 887B

1234567891011121314151617181920212223242526272829303132
  1. namespace Unity.VisualScripting
  2. {
  3. /// <summary>
  4. /// Forces saved variables to be saved to the PlayerPrefs.
  5. /// This is useful on WebGL where automatic save on quit is not supported.
  6. /// </summary>
  7. [UnitCategory("Variables")]
  8. public sealed class SaveVariables : Unit
  9. {
  10. [DoNotSerialize]
  11. [PortLabelHidden]
  12. public ControlInput enter { get; private set; }
  13. [DoNotSerialize]
  14. [PortLabelHidden]
  15. public ControlOutput exit { get; private set; }
  16. protected override void Definition()
  17. {
  18. enter = ControlInput(nameof(enter), Enter);
  19. exit = ControlOutput(nameof(exit));
  20. Succession(enter, exit);
  21. }
  22. private ControlOutput Enter(Flow arg)
  23. {
  24. SavedVariables.SaveDeclarations(SavedVariables.merged);
  25. return exit;
  26. }
  27. }
  28. }