public void SaveLoadTest() { SettingsObject.Instance.Common.ClearTmpFolder = true; SettingsObject settingsObject = SettingsObject.Load(); Assert.AreEqual(true, settingsObject.Common.ClearTmpFolder); SettingsObject.Instance.Common.ClearTmpFolder = false; settingsObject = SettingsObject.Load(); Assert.AreEqual(false, settingsObject.Common.ClearTmpFolder); }
public static SettingsProvider CreateSettingsProvider() => new SettingsProvider(SETTINGS_MENU, SettingsScope.Project) { activateHandler = (searchContext, rootElement) => { if (!instance) { instance = CreateInstance <SettingsObject>(); instance.Load(); } var template = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>(SETTINGS_TEMPLATE); template.CloneTree(rootElement); rootElement.Bind(new SerializedObject(instance)); }, inspectorUpdateHandler = () => { if (instance) { instance.Save(); } }, };