Class SuperSerializedObject
- Namespace
- LoM.Super.Serialization
- Assembly
- LoM.Super.Editor.dll
SuperSerializedObject and SuperSerializedProperty are classes for editing serialized field
on Object|Unity objects in a completely generic way. These classes automatically
handle dirtying individual serialized fields so they will be processed by the
Undo system and styled correctly for Prefab overrides when drawn in the Inspector.
Unlike the SerializedObject and SerializedProperty classes provided by Unity,
this class supports Properties and Fields
public class SuperSerializedObject : SerializedObject
- Inheritance
-
SuperSerializedObject
Constructors
SuperSerializedObject(Object)
Create SerializedObject for inspected object.
public SuperSerializedObject(Object obj)
Parameters
obj
Object
SuperSerializedObject(Object, Object)
Create SerializedObject for inspected object by specifying a context to be used to store and resolve ExposedReference types.
public SuperSerializedObject(Object obj, Object context)
Parameters
SuperSerializedObject(Object[])
Create SerializedObject for inspected object.
public SuperSerializedObject(Object[] objs)
Parameters
objs
Object[]
SuperSerializedObject(Object[], Object)
Create SerializedObject for inspected object by specifying a context to be used to store and resolve ExposedReference types.
public SuperSerializedObject(Object[] objs, Object context)
Parameters
Properties
All
public SuperSerializedProperty[] All { get; }
Property Value
Fields
public SuperSerializedProperty[] Fields { get; }
Property Value
Methods
public MethodInfo[] Methods { get; }
Property Value
Properties
public SuperSerializedProperty[] Properties { get; }
Property Value
Type
public Type Type { get; }
Property Value
TypeName
public string TypeName { get; }
Property Value
context
The context used to store and resolve ExposedReference types. This is set by the SerializedObject constructor.
public Object context { get; }
Property Value
forceChildVisibility
Controls the visibility of the child hidden fields.
public bool forceChildVisibility { get; }
Property Value
hasModifiedProperties
Is true when the SerializedObject has a modified property that has not been applied.
public bool hasModifiedProperties { get; }
Property Value
isEditingMultipleObjects
Does the serialized object represents multiple objects due to multi-object editing? (Read Only)
public bool isEditingMultipleObjects { get; }
Property Value
maxArraySizeForMultiEditing
Defines the maximum size beyond which arrays cannot be edited when multiple objects are selected.
public int maxArraySizeForMultiEditing { get; }
Property Value
targetObject
The inspected objects (Read Only).
public Object targetObject { get; }
Property Value
targetObjects
The inspected object (Read Only).
public Object[] targetObjects { get; }
Property Value
- Object[]
Methods
ApplyModifiedProperties()
Apply property modifications.
public bool ApplyModifiedProperties()
Returns
ApplyModifiedPropertiesWithoutUndo()
Applies property modifications without registering an undo operation.
public bool ApplyModifiedPropertiesWithoutUndo()
Returns
CopyFromSerializedProperty(SerializedProperty)
Copies a value from a SerializedProperty to the corresponding serialized property on the serialized object.
public void CopyFromSerializedProperty(SerializedProperty prop)
Parameters
prop
SerializedProperty
CopyFromSerializedPropertyIfDifferent(SerializedProperty)
Copies a changed value from a SerializedProperty to the corresponding serialized property on the serialized object.
public bool CopyFromSerializedPropertyIfDifferent(SerializedProperty prop)
Parameters
prop
SerializedProperty
Returns
Dispose()
public void Dispose()
FindAllPropertiesByPath(string)
public SuperSerializedProperty[] FindAllPropertiesByPath(string propertyPath)
Parameters
propertyPath
string
Returns
FindProperty(string)
[Obsolete("Use FindPropertyByPath instead.", false)]
public SerializedProperty FindProperty(string propertyPath)
Parameters
propertyPath
string
Returns
FindPropertyByPath(string)
Find serialized property by name.
public SuperSerializedProperty FindPropertyByPath(string propertyPath)
Parameters
propertyPath
string
Returns
GetIterator()
Get the first serialized property.
public SerializedProperty GetIterator()
Returns
InvokeMethod(string)
Invoke a method on the target object / objects.
public void InvokeMethod(string methodName)
Parameters
methodName
stringName of the method to be invoked
InvokeMethod(string, Object)
Invoke a method on a specific target object.
public void InvokeMethod(string methodName, Object obj)
Parameters
InvokeMethod<T>(string, params object[])
Invoke a method on the target object / objects with parameters.
public T InvokeMethod<T>(string methodName, params object[] parameters)
Parameters
methodName
stringName of the method to be invoked
parameters
object[]Parameters to be passed to the method
Returns
- T
Return value of the method
Type Parameters
T
Type of the parameter
InvokeMethod<T>(string, Object, params object[])
Invoke a method on a specific target object with parameters.
public T InvokeMethod<T>(string methodName, Object obj, params object[] parameters)
Parameters
methodName
stringName of the method to be invoked
obj
ObjectTarget object
parameters
object[]Parameters to be passed to the method
Returns
- T
Return value of the method
Type Parameters
T
Type of the parameter
SetIsDifferentCacheDirty()
Update hasMultipleDifferentValues cache on the next Update() call.
public void SetIsDifferentCacheDirty()
Update()
Update serialized object's representation.
public void Update()
UpdateIfDirtyOrScript()
This has been made obsolete. See SerializedObject.UpdateIfRequiredOrScript instead.
[Obsolete("UpdateIfDirtyOrScript has been deprecated. Use UpdateIfRequiredOrScript instead.", false)]
public void UpdateIfDirtyOrScript()
UpdateIfRequiredOrScript()
Update serialized object's representation, only if the object has been modified since the last call to Update or if it is a script.
public void UpdateIfRequiredOrScript()