Summary
An
Weaver.InjectionAttribute
which saves and loads the value of the attributed member in
UnityEditor.EditorPrefs
.
- Assembly
- Weaver
.dll - Namespace
- Weaver
- Interfaces
-
- IInjector
- IHasCustomMenu
- WeaverWindow
.IItem
- Base Types
-
- Attribute
- InjectionAttribute
- PrefAttribute
graph BT
Type-->Base0["PrefAttribute"]
click Base0 "/weaver/api/Weaver/PrefAttribute"
Base0-->Base1["InjectionAttribute"]
click Base1 "/weaver/api/Weaver/InjectionAttribute"
Base1-->Base2["Attribute"]
Type-.->Interface0["IInjector"]
Type-.->Interface1["IHasCustomMenu"]
Type-.->Interface2["WeaverWindow.IItem"]
Type["EditorPrefAttribute"]
class Type type-node
Syntax
public sealed class EditorPrefAttribute : PrefAttribute, IInjector, IHasCustomMenu,
WeaverWindow.IItem
Constructors
Name | Summary |
---|---|
EditorPrefAttribute |
[Editor-Only] Creates a new Weaver.EditorPrefAttribute . |
Events
Name | Type | Summary |
---|---|---|
OnSave | Action |
A callback which is invoked by
Weaver.PrefAttribute.SaveAll .
Inherited from PrefAttribute
static
|
Fields
Name | Constant Value | Summary |
---|---|---|
_InspectorTooltip |
[Editor-Only]
The cached tooltip of this attribute. Should only be read by
Weaver.InjectionAttribute.GetInspectorTooltip .
Inherited from InjectionAttribute
|
|
_ToString |
[Editor-Only] Cached return value of
Weaver.InjectionAttribute.ToString .Inherited from InjectionAttribute
|
Properties
Name | Value | Summary |
---|---|---|
DefaultValue | Object |
[Editor-Only]
The initial value of the attributed member before it was injected.
Inherited from PrefAttribute
|
EditorOnly | bool |
If set to true, this attribute won't be used in builds. Must be set for attributes inside
#if UNITY_EDITOR regions since that fact can't be detected automatically.
Inherited from InjectionAttribute
|
InEditMode | bool |
[Editor-Only]
Returns true. Prefs should always have their saved value.
Inherited from PrefAttribute
|
Key | string |
The name that will be used to identify the saved value.
If not set, it will use the attributed member's Namespace.DeclaringType.Name.
Inherited from PrefAttribute
|
OldKey | string |
The
Weaver.PrefAttribute.Key that the pref was previously saved with.
Inherited from PrefAttribute
|
Optional | bool |
If set to true, this attribute will not give any errors when it is unable to initialize with an appropriate value.
Inherited from InjectionAttribute
|
PrefsTypeName | string |
[Editor-Only] [Pro-Only]
The full name of the prefs class to use when building the procedural injector script.
|
ShouldShow | bool |
[Editor-Only]
Indicates whether this attribute should currently be visible in the
Weaver.Editor.Window.WeaverWindow .
Inherited from InjectionAttribute
|
Tooltip | string |
A description of the purpose of the attributed property to be shown in the Unity Editor.
Inherited from InjectionAttribute
|
Type | PrefAttribute |
[Editor-Only] The
Weaver.PrefAttribute.PrefType of the attributed member.Inherited from PrefAttribute
|
Methods
Name | Value | Summary |
---|---|---|
AddItemsToMenu |
void |
[Editor-Only]
Adds various functions for this attribute to the `menu`.
Inherited from PrefAttribute
|
AppendDetail |
void |
[Editor-Only]
Appends an opening bracket or comma depending on `isFirst` followed by the specified `detail` and sets
`isFirst` to false. Intended for use within
Weaver.InjectionAttribute.AppendDetails(System.Text.StringBuilder,System.Boolean@) .
Inherited from InjectionAttribute
|
AppendDetails |
void |
[Editor-Only]
Appends any optional properties that have been set on this attribute.
Inherited from PrefAttribute
|
AppendPrefGetter |
void |
[Editor-Only] [Pro-Only]
Appends C# code to get the value of this pref from persistent storage.
Inherited from PrefAttribute
|
AppendPrefSetter |
void |
[Editor-Only] [Pro-Only]
Appends C# code to save the value of this pref to persistent storage.
Inherited from PrefAttribute
|
CheckContextMenu |
void |
[Editor-Only]
Calls
Weaver.InjectionAttribute.CheckContextMenu(UnityEngine.Rect) with the last UnityEngine.GUILayout rect.
Inherited from InjectionAttribute
|
CheckContextMenu |
void |
[Editor-Only]
If the current event is a
UnityEngine.EventType.ContextClick inside the `area`, this method builds a menu
using Weaver.InjectionAttribute.AddItemsToMenu(UnityEditor.GenericMenu) and shows it.
Inherited from InjectionAttribute
|
DoInspectorGUI |
void |
[Editor-Only] Draws the inspector GUI for this attribute.
Inherited from PrefAttribute
|
Equals |
bool |
[Editor-Only] Uses
System.Object.ReferenceEquals(System.Object,System.Object) instead of the default System.Attribute.Equals(System.Object) .Inherited from InjectionAttribute
|
GetFloat |
float |
[Editor-Only] Returns the float value saved with the specified `key`.
Inherited from PrefAttribute
|
GetHashCode |
int |
[Editor-Only] Returns the hash code for this instance.
Inherited from InjectionAttribute
|
GetInspectorTooltip |
string |
[Editor-Only]
Builds, caches, and returns a tooltip message for this attribute.
Inherited from InjectionAttribute
|
GetInt |
int |
[Editor-Only] Returns the int value saved with the specified `key`.
Inherited from PrefAttribute
|
Get |
string |
[Editor-Only]
Returns a message indicating that no value has been assigned for this attribute.
Inherited from InjectionAttribute
|
GetPrefType |
PrefAttribute |
[Editor-Only]
Returns the
Weaver.PrefAttribute.PrefType associated with the specified `type`.
Inherited from PrefAttribute
static
|
GetString |
string |
[Editor-Only] Returns the string value saved with the specified `key`.
Inherited from PrefAttribute
|
GetTempLabelContent |
GUIContent |
[Editor-Only]
Returns a reusable
UnityEngine.GUIContent containing the name, tooltip, and icon of this attribute.
Inherited from InjectionAttribute
|
GetValue |
Object |
[Editor-Only]
Tries to get the value of the attributed member. Catches and logs any exceptions.
Inherited from InjectionAttribute
|
GetValueToInject |
Object |
[Editor-Only]
Returns a value to be assigned to the attributed property.
|
HasKey |
bool |
[Editor-Only] Indicates whether a value has been saved using the specified `key`.
Inherited from PrefAttribute
|
IsSupportedPref |
bool |
[Editor-Only]
Indicates whether the specified `type` can be saved as a pref.
static
|
IsSupportedPref |
bool |
[Editor-Only]
Indicates whether the specified `type` can be saved as a pref.
Inherited from PrefAttribute
static
|
Log |
bool |
[Editor-Only]
Logs a message indicating that this attribute is invalid, followed by a `message` explaining why.
Returns false.
Inherited from InjectionAttribute
|
SaveAll |
void |
Writes the values of all prefs to their persistent storage.
Inherited from PrefAttribute
static
|
SetFloat |
void |
[Editor-Only] Saves the specified float `value` with the specified `key`.
Inherited from PrefAttribute
|
SetInt |
void |
[Editor-Only] Saves the specified int `value` with the specified `key`.
Inherited from PrefAttribute
|
SetString |
void |
[Editor-Only] Saves the specified string `value` with the specified `key`.
Inherited from PrefAttribute
|
SetValue |
void |
[Editor-Only]
Tries to set the value of the attributed member. Catches and logs any exceptions.
Inherited from InjectionAttribute
|
ToString |
string |
[Editor-Only] Returns a description of this attribute.
Inherited from InjectionAttribute
|
TryInitialize |
bool |
[Editor-Only]
Attempts to initialize this attribute and returns true if successful.
Specifically, this method ensures that the
Weaver.InjectionAttribute.MemberType is a supported pref
type.
Inherited from PrefAttribute
|
Operators
Name | Value | Summary |
---|---|---|
operator != |
bool |
Inherited from InjectionAttribute
|
operator == |
bool |
Inherited from InjectionAttribute
|