Class ProjectPreferences
Utility to save preferences that should be saved per project (i.e to source control) across MRTK. Supports primitive preferences bool, int, and float
Namespace: Microsoft.MixedReality.Toolkit.Utilities.Editor
Assembly: cs.temp.dll.dll
Syntax
public class ProjectPreferences : ScriptableObject
Properties
FilePath
Declaration
protected static string FilePath { get; }
Property Value
| Type | Description |
|---|---|
| String |
Methods
Get(String, Boolean)
Get bool from Project Preferences. If no entry found, then create new entry with provided defaultValue
Declaration
public static bool Get(string key, bool defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| String | key | |
| Boolean | defaultValue |
Returns
| Type | Description |
|---|---|
| Boolean |
Get(String, Int32)
Get int from Project Preferences. If no entry found, then create new entry with provided defaultValue
Declaration
public static int Get(string key, int defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| String | key | |
| Int32 | defaultValue |
Returns
| Type | Description |
|---|---|
| Int32 |
Get(String, Single)
Get float from Project Preferences. If no entry found, then create new entry with provided defaultValue
Declaration
public static float Get(string key, float defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| String | key | |
| Single | defaultValue |
Returns
| Type | Description |
|---|---|
| Single |
Get(String, String)
Get string from Project Preferences. If no entry found, then create new entry with provided defaultValue
Declaration
public static string Get(string key, string defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| String | key | |
| String | defaultValue |
Returns
| Type | Description |
|---|---|
| String |
RemoveBool(String)
Remove key item from preferences if applicable
Declaration
public static void RemoveBool(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| String | key |
RemoveFloat(String)
Remove key item from preferences if applicable
Declaration
public static void RemoveFloat(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| String | key |
RemoveInt(String)
Remove key item from preferences if applicable
Declaration
public static void RemoveInt(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| String | key |
RemoveString(String)
Remove key item from preferences if applicable
Declaration
public static void RemoveString(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| String | key |
Set(String, Boolean, Boolean)
Save bool to preferences and save to ScriptableObject with key given.
Declaration
public static void Set(string key, bool value, bool forceSave = true)
Parameters
| Type | Name | Description |
|---|---|---|
| String | key | |
| Boolean | value | |
| Boolean | forceSave |
Remarks
If forceSave is true (default), then will call AssetDatabase.SaveAssets which saves all assets after execution
Set(String, Int32, Boolean)
Save int to preferences and save to ScriptableObject with key given.
Declaration
public static void Set(string key, int value, bool forceSave = true)
Parameters
| Type | Name | Description |
|---|---|---|
| String | key | |
| Int32 | value | |
| Boolean | forceSave |
Remarks
If forceSave is true (default), then will call AssetDatabase.SaveAssets which saves all assets after execution
Set(String, Single, Boolean)
Save float to preferences and save to ScriptableObject with key given.
Declaration
public static void Set(string key, float value, bool forceSave = true)
Parameters
| Type | Name | Description |
|---|---|---|
| String | key | |
| Single | value | |
| Boolean | forceSave |
Remarks
If forceSave is true (default), then will call AssetDatabase.SaveAssets which saves all assets after execution
Set(String, String, Boolean)
Save string to preferences and save to ScriptableObject with key given.
Declaration
public static void Set(string key, string value, bool forceSave = true)
Parameters
| Type | Name | Description |
|---|---|---|
| String | key | |
| String | value | |
| Boolean | forceSave |
Remarks
If forceSave is true (default), then will call AssetDatabase.SaveAssets which saves all assets after execution