Serialization Class

Summary

[Editor-Only] Various serialization utilities.
Assembly
Animancer.dll
Namespace
Animancer.Editor
Base Types
  • Object
graph BT Type-->Base0["Object"] Type["Serialization"] class Type type-node

Syntax

public static class Serialization

Fields

Name Constant Value Summary
ArrayDataPrefix .Array.data[
The text used in a UnityEditor.SerializedProperty.propertyPath to denote array elements.
static
ArrayDataSuffix ]
The text used in a UnityEditor.SerializedProperty.propertyPath to denote array elements.
static
InstanceBindings 52
Bindings for Public and Non-Public Instance members.
static

Methods

Name Value Summary
AddFunction(GenericMenu, string, bool, GenericMenu.MenuFunction) void
Adds a menu item to execute the specified `function` for each of the `property`s target objects.
static
AddFunction(GenericMenu, string, MenuFunctionState, GenericMenu.MenuFunction) void
Adds a menu item to execute the specified `function` for each of the `property`s target objects.
static
AddPropertyModifierFunction(GenericMenu, SerializedProperty, string, Action<SerializedProperty>) void
Adds a menu item to execute the specified `function` for each of the `property`s target objects.
static
AddPropertyModifierFunction(GenericMenu, SerializedProperty, string, bool, Action<SerializedProperty>) void
Adds a menu item to execute the specified `function` for each of the `property`s target objects.
static
AddPropertyModifierFunction(GenericMenu, SerializedProperty, string, MenuFunctionState, Action<SerializedProperty>) void
Adds a menu item to execute the specified `function` for each of the `property`s target objects.
static
AreSameProperty(SerializedProperty, SerializedProperty) bool
Indicates whether both properties refer to the same underlying field.
static
CopyValueFrom(SerializedProperty, SerializedProperty) float
Copies the value of `from` into `to` (including all nested properties).
static
ForEachTarget(SerializedProperty, Action<SerializedProperty>, string) void
Executes the `action` once with a new UnityEditor.SerializedProperty for each of the UnityEditor.SerializedObject.targetObjects. Or if there is only one target, it uses the `property`.
static
GetAccessor(SerializedProperty) Serialization.PropertyAccessor
Returns an Animancer.Editor.Serialization.PropertyAccessor that can be used to access the details of the specified `property`.
static
GetField(Serialization.PropertyAccessor, SerializedProperty, Type, string) FieldInfo
Returns a field with the specified `name` in the `declaringType` or any of its base types.
static
GetField(Type, string) FieldInfo
Returns a field with the specified `name` in the `declaringType` or any of its base types.
static
GetFriendlyPath(SerializedProperty) string
Returns a user friendly version of the UnityEditor.SerializedProperty.propertyPath.
static
GetGradientValue(SerializedProperty) Gradient
Gets the UnityEngine.Gradient value from a UnityEditor.SerializedPropertyType.Gradient.
static
GetPropertyType(Type) SerializedPropertyType
Returns the UnityEditor.SerializedPropertyType that represents fields of the specified `type`.
static
GetValue(SerializedProperty) Object
Gets the value of the UnityEditor.SerializedProperty.
static
GetValue(SerializedProperty, Object) Object
Gets the value of the specified UnityEditor.SerializedProperty.
static
GetValue<T>(SerializedProperty) T
Gets the value of the UnityEditor.SerializedProperty.
static
GetValue<T>(SerializedProperty, T) void
Gets the value of the UnityEditor.SerializedProperty.
static
GetValues<T>(SerializedProperty) T[]
Gets the value of the UnityEditor.SerializedProperty for each of its target objects.
static
IsDefaultValueByType(SerializedProperty) bool
Is the value of the `property` the same as the default serialized value for its type?
static
IsValid(Serialization.ObjectReference) bool
Returns true if the `reference` and Animancer.Editor.Serialization.ObjectReference.Object are not null.
static
IsValid(Serialization.PropertyReference) bool
Returns true if the `reference` and Animancer.Editor.Serialization.PropertyReference.Property are not null.
static
ModifyValues<T>(SerializedProperty, Action<T>, string) void
Calls the specified `method` for each of the underlying values of the `property` (in case it represents multiple selected objects) and records an undo step for any modifications made.
static
OnPropertyChanged(SerializedProperty) void
Updates the specified `property` and marks its target objects as dirty so any changes to a prefab will be saved.
static
RecordUndo(SerializedProperty, string) void
Records the state of the specified `property` so it can be undone.
static
RemoveArrayElement(SerializedProperty, int) void
Removes the specified array element from the `property`.
static
ResetValue(SerializedProperty, string) void
Resets the value of the UnityEditor.SerializedProperty to the default value of its type and all its field types, ignoring values set by constructors or field initializers.
static
SetGradientValue(SerializedProperty, Gradient) void
Sets the UnityEngine.Gradient value on a UnityEditor.SerializedPropertyType.Gradient.
static
SetValue(SerializedProperty, Object) void
Sets the value of the UnityEditor.SerializedProperty.
static
SetValue(SerializedProperty, Object, Object) void
Sets the value of the specified UnityEditor.SerializedProperty.
static