Class SerializedPropertyExtension
Extensions for SerializedProperty
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 | 
Returns
| Type | Description | 
|---|---|
| String | 
Type Parameters
| Name | Description | 
|---|---|
| T | 
GetEnumValue<T>(SerializedProperty)
Declaration
public static T GetEnumValue<T>(this SerializedProperty property)
    where T : Enum
Parameters
| Type | Name | Description | 
|---|---|---|
| SerializedProperty | property | 
Returns
| Type | Description | 
|---|---|
| T | 
Type Parameters
| Name | Description | 
|---|---|
| T | 
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 | |
| T | value | 
Type Parameters
| Name | Description | 
|---|---|
| T | 
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.  |