AutoPrefs.

AutoPrefs.AutoPref<T> Class

Summary

An object which encapsulates a pref value stored with a specific key.
graph BT Type-->Base0["Object"] Type-.->Interface0["AutoPrefs.IAutoPref"] click Interface0 "/inspector-gadgets/api/InspectorGadgets/IAutoPref" Type["AutoPrefs.AutoPref<T>"] class Type type-node Derived0["AutoPrefs.String"]-->Type click Derived0 "/inspector-gadgets/api/InspectorGadgets/String" Derived1["AutoPrefs.Int"]-->Type click Derived1 "/inspector-gadgets/api/InspectorGadgets/Int" Derived2["AutoPrefs.Float"]-->Type click Derived2 "/inspector-gadgets/api/InspectorGadgets/Float" Derived3["AutoPrefs.Vector2"]-->Type click Derived3 "/inspector-gadgets/api/InspectorGadgets/Vector2" Derived4["AutoPrefs.Vector3"]-->Type click Derived4 "/inspector-gadgets/api/InspectorGadgets/Vector3" Derived5["AutoPrefs.Bool"]-->Type click Derived5 "/inspector-gadgets/api/InspectorGadgets/Bool" Derived6["AutoPrefs.Quaternion"]-->Type click Derived6 "/inspector-gadgets/api/InspectorGadgets/Quaternion" Derived7["AutoPrefs.Vector4"]-->Type click Derived7 "/inspector-gadgets/api/InspectorGadgets/Vector4"

Syntax

public abstract class AutoPrefs.AutoPref<T> : AutoPrefs.IAutoPref

Type Parameters

Name Description
T

Constructors

Name Summary
AutoPref(string, T, Action<T>) Constructs an InspectorGadgets.AutoPrefs.AutoPref`1 with the specified `key` and `defaultValue`.

Fields

Name Constant Value Summary
DefaultValue
The default value to use if this pref has no existing value.
Key
The key used to identify this pref.
OnValueChanged
Called when the InspectorGadgets.AutoPrefs.AutoPref`1.Value is changed.

Properties

Name Value Summary
Value T
The current value of this pref.

Methods

Name Value Summary
DeletePref() void
Deletes the value of this pref from the preferences and reverts to the default value.
GetHashCode() int
Returns a hash code for this pref.
IsSaved() bool
Returns true if the preferences currently contains a saved value for this pref.
Load() T
Loads the value of this pref from the system.
Reload() void
Reloads the value of this pref from the system.
RevertToDefaultValue() void
Sets the InspectorGadgets.AutoPrefs.AutoPref`1.Value = InspectorGadgets.AutoPrefs.AutoPref`1.DefaultValue.
Save() void
Saves the value of this pref to the system.
ToString() string
Returns Value?.ToString().

Operators

Name Value Summary
implicit operator T(AutoPrefs.AutoPref<T>) T
operator !=(AutoPrefs.AutoPref<T>, T) bool
operator ==(AutoPrefs.AutoPref<T>, T) bool

Extension Methods

Name Value Summary
DoGUI<T>(GUIContent, AutoPrefs.GUIFieldMethod<T>) bool
[Editor-Only] Draws GUI controls for this pref and returns true if the value was changed.
DoGUI<T>(GUIContent, GUIStyle, AutoPrefs.GUIFieldMethod<T>) bool
[Editor-Only] Draws GUI controls for this pref and returns true if the value was changed.
DoGUI<T>(Rect, GUIContent, GUIStyle, AutoPrefs.GUIFieldMethod<T>) bool
[Editor-Only] Draws GUI controls for this pref and returns true if the value was changed.