HasKey.cs 559 B

12345678910111213141516171819202122
  1. using UnityEngine;
  2. namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityPlayerPrefs
  3. {
  4. [TaskCategory("Unity/PlayerPrefs")]
  5. [TaskDescription("Retruns success if the specified key exists.")]
  6. public class HasKey : Conditional
  7. {
  8. [Tooltip("The key to check")]
  9. public SharedString key;
  10. public override TaskStatus OnUpdate()
  11. {
  12. return PlayerPrefs.HasKey(key.Value) ? TaskStatus.Success : TaskStatus.Failure;
  13. }
  14. public override void OnReset()
  15. {
  16. key = "";
  17. }
  18. }
  19. }