A game about forced loneliness, made by TACStudios
at master 37 lines 959 B view raw
1using System; 2 3namespace UnityEditor.Rendering 4{ 5 /// <summary> 6 /// Bool saved in EditorPref. 7 /// </summary> 8 public struct EditorPrefBool 9 { 10 readonly string m_Key; 11 12 /// <summary> 13 /// Value of the boolean in editor preferences. 14 /// </summary> 15 public bool value 16 { 17 get => EditorPrefs.GetBool(m_Key); 18 set => EditorPrefs.SetBool(m_Key, value); 19 } 20 21 /// <summary> 22 /// Constructor 23 /// </summary> 24 /// <param name="key">Key in the editor preferences.</param> 25 /// <param name="defaultValue">Default value of the preference.</param> 26 public EditorPrefBool(string key, bool defaultValue = false) 27 { 28 m_Key = key; 29 30 //register key if not already there 31 if (!EditorPrefs.HasKey(m_Key)) 32 { 33 EditorPrefs.SetBool(m_Key, defaultValue); 34 } 35 } 36 } 37}