using System; namespace UnityEditor.Rendering { /// /// Bool saved in EditorPref. /// public struct EditorPrefBool { readonly string m_Key; /// /// Value of the boolean in editor preferences. /// public bool value { get => EditorPrefs.GetBool(m_Key); set => EditorPrefs.SetBool(m_Key, value); } /// /// Constructor /// /// Key in the editor preferences. /// Default value of the preference. public EditorPrefBool(string key, bool defaultValue = false) { m_Key = key; //register key if not already there if (!EditorPrefs.HasKey(m_Key)) { EditorPrefs.SetBool(m_Key, defaultValue); } } } }