Class SerializedPropertyExtension
Extensions for SerializedProperty
Inherited Members
Namespace: UnityEditor.Rendering
Assembly: Unity.RenderPipelines.Core.Editor.dll
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 | 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 |
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 |
---|---|
bool | 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 | 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. |