SerializedPropertyExtensions¶
Namespace:
SideXP.Core.EditorOnly
Extension functions for SerializedProperty instances.
Methods¶
GetLabel(SerializedProperty)¶
Gets the field label of a serialized property.
Parameters
property: The property you want to get the label.
Returns
Returns the label of the given property.
GetTarget(SerializedProperty)¶
Gets the target object of this SerializedProperty. This function is inspired by the SpacePuppy Unity Framework: https://github.com/lordofduct/spacepuppy-unity-framework-4.0/blob/master/Framework/com.spacepuppy.core/Editor/src/EditorHelper.cs
Parameters
property: The property of which you want to get the target object.
Returns
Returns the found target object.
GetTarget<T>(SerializedProperty)¶
Gets the target object of this SerializedProperty. This function is inspired by the SpacePuppy Unity Framework: https://github.com/lordofduct/spacepuppy-unity-framework-4.0/blob/master/Framework/com.spacepuppy.core/Editor/src/EditorHelper.cs
Type parameters
T: The expected target type.
Parameters
property: The property of which you want to get the target object.
Returns
Returns the found target object.
GetTargetType(SerializedProperty)¶
Gets the type of a property, using its path.
Parameters
property: The property you want to get the type.
Returns
Returns the target type of the property.
Remarks
Note that this function doesn't need the property to be assigned.
TryGetTargetType(SerializedProperty, Type)¶
Gets the type of a property, using its path.
Parameters
targetType: Outputs the target type of the property.property: The property you want to get the type.
Returns
Returns true if the target type has been retrieved successfully.
Remarks
Note that this function doesn't need the property to be assigned.
IsArrayElement(SerializedProperty)¶
Checks if the given property is an array element.
Parameters
property: The property to check.
Returns
Returns true if the given property is an array element.
Remarks
This can be useful to remove unnecessary labels in the displayed items.