forked from microsoft/MixedRealityToolkit-Unity
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEditorPrefs.cs
More file actions
43 lines (36 loc) · 1.33 KB
/
Copy pathEditorPrefs.cs
File metadata and controls
43 lines (36 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using UnityEditor;
using UnityEngine;
namespace HoloToolkit.Unity
{
public static class EditorPrefsUtility
{
public static void SetEditorPref(string key, string value)
{
EditorPrefs.SetString(Application.productName + key, value);
}
public static void SetEditorPref(string key, bool value)
{
EditorPrefs.SetBool(Application.productName + key, value);
}
public static string GetEditorPref(string key, string defaultValue)
{
if (EditorPrefs.HasKey(Application.productName + key))
{
return EditorPrefs.GetString(Application.productName + key);
}
EditorPrefs.SetString(Application.productName + key, defaultValue);
return defaultValue;
}
public static bool GetEditorPref(string key, bool defaultValue)
{
if (EditorPrefs.HasKey(Application.productName + key))
{
return EditorPrefs.GetBool(Application.productName + key);
}
EditorPrefs.SetBool(Application.productName + key, defaultValue);
return defaultValue;
}
}
}