SerializedPropertyExtensions Class Reference

Contains extension functions for SerializedProperty to allow direct access to their values via reflection.

Static Public Member Functions

static SerializedProperty FindPropertyRelativeFix (this SerializedProperty sp, string name, ref SerializedObject objectToApplyChanges)
 Extension function for SerializedProperties. If the SerializedProperty is a type of Scriptable Object, the normal FindPropertyRelative function does not work right. This version checks for that case, and provides necessary workarounds, transparently.
 
static System.Type GetFieldType (this SerializedProperty property)
 This SerializedPropety extension function takes an instance of a Serialized Property and returns the System.Type of the field it represents. If the property is an array or list element, the type returned will be the type of the elements in the array.
 
static System.Reflection.FieldInfo GetFieldViaPath (this System.Type type, string path)
 Given a Unity SerialiazatbleProperty path, get the field it points to.
 
static object GetValue (this SerializedProperty property, bool displayWarnings=false)
 This SerializedPropety extension function takes an instance of a Serialized Property and returns the runtime contents of the field it represents.
 
static object GetValueViaPath (this object rootObject, string path)
 Given a Unity SerialiazatbleProperty path, and an object reference, get the value in the object's field referenced by the path.
 
static void SetValue (this SerializedProperty property, object value, bool displayWarnings=false)
 This SerializedPropety extension function takes an instance of a Serialized Property and assigns a new value to the runtime contents of the field it represents.
 
static void SetValueViaPath (this object rootObject, string path, object ValueToAssign)
 Given a Unity SerialiazatbleProperty path, and an object reference, set the value in the object's field referenced by the path to the value specified in ValueToAssign.