Class SerializedPropertyHelper
Helpers for the editor relating to SerializedPropertys
Inherited Members
Namespace: Cinemachine.Editor
Assembly: com.unity.cinemachine.editor.dll
Syntax
public static class SerializedPropertyHelper
Methods
FindProperty(SerializedObject, Expression<Func<object>>)
A compiler-assisted (non-string-based) way to call SerializedProperty.FindProperty
Declaration
public static SerializedProperty FindProperty(this SerializedObject obj, Expression<Func<object>> exp)
Parameters
Type | Name | Description |
---|---|---|
Serialized |
obj | The serialized object to search |
Expression<Func<object>> | exp | Magic expression that resolves to a field: () => myClass.m_MyField |
Returns
Type | Description |
---|---|
Serialized |
The resulting SerializedProperty, or null |
FindPropertyRelative(SerializedProperty, Expression<Func<object>>)
A compiler-assisted (non-string-based) way to call SerializedProperty.FindPropertyRelative
Declaration
public static SerializedProperty FindPropertyRelative(this SerializedProperty obj, Expression<Func<object>> exp)
Parameters
Type | Name | Description |
---|---|---|
Serialized |
obj | The serialized object to search |
Expression<Func<object>> | exp | Magic expression that resolves to a field: () => myClass.m_MyField |
Returns
Type | Description |
---|---|
Serialized |
The resulting SerializedProperty, or null |
GetPropertyValue(SerializedProperty)
Get the value of a proprty, as an object
Declaration
public static object GetPropertyValue(SerializedProperty property)
Parameters
Type | Name | Description |
---|---|---|
Serialized |
property | The property to query |
Returns
Type | Description |
---|---|
object | The object value of the property |
PropertyName(Expression<Func<object>>)
This is a way to get a field name string in such a manner that the compiler will generate errors for invalid fields. Much better than directly using strings.
Declaration
public static string PropertyName(Expression<Func<object>> exp)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<object>> | exp | Magic expression that resolves to a field: () => myClass.m_MyField |
Returns
Type | Description |
---|---|
string | The property name as a string |