SetString.cs 676 B

123456789101112131415161718192021222324252627
  1. using UnityEngine;
  2. namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityPlayerPrefs
  3. {
  4. [TaskCategory("Unity/PlayerPrefs")]
  5. [TaskDescription("Sets the value with the specified key from the PlayerPrefs.")]
  6. public class SetString : Action
  7. {
  8. [Tooltip("The key to store")]
  9. public SharedString key;
  10. [Tooltip("The value to set")]
  11. public SharedString value;
  12. public override TaskStatus OnUpdate()
  13. {
  14. PlayerPrefs.SetString(key.Value, value.Value);
  15. return TaskStatus.Success;
  16. }
  17. public override void OnReset()
  18. {
  19. key = "";
  20. value = "";
  21. }
  22. }
  23. }