docs.unity.cn
    Show / Hide Table of Contents

    Class SerializedPropertyExtension

    Extensions for SerializedProperty

    Inheritance
    Object
    SerializedPropertyExtension
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEditor.Rendering
    Syntax
    public static class SerializedPropertyExtension

    Methods

    GetEnumName<T>(SerializedProperty)

    Helper to get an enum name from a SerializedProperty

    Declaration
    public static string GetEnumName<T>(this SerializedProperty property)
        where T : Enum
    Parameters
    Type Name Description
    SerializedProperty property

    The SerializedProperty

    Returns
    Type Description
    String

    The string containing the name of the enum

    Type Parameters
    Name Description
    T

    A valid Enum

    GetEnumValue<T>(SerializedProperty)

    Helper to get an enum value from a SerializedProperty. This handle case where index do not correspond to enum value.

    Declaration
    public static T GetEnumValue<T>(this SerializedProperty property)
        where T : Enum
    Parameters
    Type Name Description
    SerializedProperty property

    The SerializedProperty

    Returns
    Type Description
    T

    The Enum value

    Type Parameters
    Name Description
    T

    A valid Enum

    GetInline<T>(SerializedProperty)

    Get the value of a SerializedProperty.

    This function will be inlined by the compiler. Caution: The case of Enum is not handled here.

    Declaration
    public static T GetInline<T>(this SerializedProperty serializedProperty)
        where T : struct
    Parameters
    Type Name Description
    SerializedProperty serializedProperty

    The property to get.

    Returns
    Type Description
    T

    The value of the property.

    Type Parameters
    Name Description
    T

    The type of the value to get.

    It is expected to be a supported type by the SerializedProperty.

    IsTargetAlive(SerializedProperty)

    Checks if the property target is alive

    Declaration
    public static bool IsTargetAlive(this SerializedProperty property)
    Parameters
    Type Name Description
    SerializedProperty property

    The SerializedProperty to check

    Returns
    Type Description
    Boolean

    true, if the property is not null

    SetEnumValue<T>(SerializedProperty, T)

    Helper to set an enum value to a SerializedProperty

    Declaration
    public static void SetEnumValue<T>(this SerializedProperty property, T value)
        where T : Enum
    Parameters
    Type Name Description
    SerializedProperty property

    The SerializedProperty

    T value

    The Enum

    Type Parameters
    Name Description
    T

    A valid Enum

    SetInline<T>(SerializedProperty, T)

    Set the value of a SerializedProperty.

    This function will be inlined by the compiler. Caution: The case of Enum is not handled here.

    Declaration
    public static void SetInline<T>(this SerializedProperty serializedProperty, T value)
        where T : struct
    Parameters
    Type Name Description
    SerializedProperty serializedProperty

    The property to set.

    T value

    The value to set.

    Type Parameters
    Name Description
    T

    The type of the value to set.

    It is expected to be a supported type by the SerializedProperty.

    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on 31 July 2023