#if GRAPH_DESIGNER /// --------------------------------------------- /// Behavior Designer /// Copyright (c) Opsive. All Rights Reserved. /// https://www.opsive.com /// --------------------------------------------- namespace Opsive.BehaviorDesigner.Runtime.Tasks.Conditionals.SaveLoadTasks { using Opsive.GraphDesigner.Runtime; using Opsive.GraphDesigner.Runtime.Variables; using UnityEngine; /// /// Checks if a PlayerPrefs key exists. /// [Opsive.Shared.Utility.Category("Save//Load")] [Opsive.Shared.Utility.Description("Checks if a PlayerPrefs key exists.")] public class PlayerPrefsHasKey : Conditional { [Tooltip("The PlayerPrefs key to check.")] [SerializeField] protected SharedVariable m_Key; /// /// Executes the conditional. /// public override TaskStatus OnUpdate() { if (string.IsNullOrEmpty(m_Key.Value)) { return TaskStatus.Failure; } return PlayerPrefs.HasKey(m_Key.Value) ? TaskStatus.Success : TaskStatus.Failure; } } } #endif