docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class SerializedPropertyHelper

    Helpers for the editor relating to SerializedPropertys

    Inheritance
    object
    SerializedPropertyHelper
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    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
    SerializedObject obj

    The serialized object to search

    Expression<Func<object>> exp

    Magic expression that resolves to a field: () => myClass.m_MyField

    Returns
    Type Description
    SerializedProperty

    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
    SerializedProperty obj

    The serialized object to search

    Expression<Func<object>> exp

    Magic expression that resolves to a field: () => myClass.m_MyField

    Returns
    Type Description
    SerializedProperty

    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
    SerializedProperty 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

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)