You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CrowdControl/Assets/Plugins/NaughtyAttributes/Scripts/Editor/Utility/SavedBool.cs

34 lines
445 B
C#

3 months ago
using UnityEditor;
namespace NaughtyAttributes.Editor
{
internal class SavedBool
{
private bool _value;
private string _name;
public bool Value
{
get
{
return _value;
}
set
{
if (_value == value)
{
return;
}
_value = value;
EditorPrefs.SetBool(_name, value);
}
}
public SavedBool(string name, bool value)
{
_name = name;
_value = EditorPrefs.GetBool(name, value);
}
}
}