Table of Contents

Class BasePropertyDrawer

Namespace
CodeBase
Assembly
4Experience.CodeBase.Core.Editor.dll

Simple implementation of custom property drawer. It could be used as a base for the own property drawers for Serializable class or members with custom PropertyAttributes. It provides the functionality of representing a array of strings like an enum selectable from a dropdown.

public class BasePropertyDrawer : ExtendedPropertyDrawer
Inheritance
GUIDrawer
PropertyDrawer
BasePropertyDrawer
Derived
Extension Methods

Properties

EnumIndex

protected int EnumIndex { get; set; }

Property Value

int

Methods

DrawEnum(Rect, SerializedProperty, int, string[])

Used to draw an array of strings in the form of a selectable dropdown. Applied to string property.

protected void DrawEnum(Rect position, SerializedProperty property, int startEnumIndex, string[] enumValues)

Parameters

position Rect
property SerializedProperty
startEnumIndex int
enumValues string[]

DrawEnum(Rect, SerializedProperty, int, string[], string[])

Used to draw an array of strings in the form of a selectable dropdown. Applied to string property.

The fields in the dropdown will be named as specified in the additional label array.
protected void DrawEnum(Rect position, SerializedProperty property, int startEnumIndex, string[] enumValues, string[] displayedValues)

Parameters

position Rect
property SerializedProperty
startEnumIndex int
enumValues string[]
displayedValues string[]

DrawEnum(Rect, SerializedProperty, GUIContent, int, string[])

Used to draw an array of strings in the form of a selectable dropdown. Applied to string property.

It uses a GUILabel object that is overwritten in a specific OnGUI method.
protected void DrawEnum(Rect position, SerializedProperty property, GUIContent label, int startEnumIndex, string[] enumValues)

Parameters

position Rect
property SerializedProperty
label GUIContent
startEnumIndex int
enumValues string[]

DrawEnum(Rect, SerializedProperty, GUIContent, int, string[], string[])

Used to draw an array of strings in the form of a selectable dropdown. Applied to string property.

It uses a GUILabel object that is overwritten in a specific OnGUI method. The fields in the dropdown will have the name as given in the additional label array.
protected void DrawEnum(Rect position, SerializedProperty property, GUIContent label, int startEnumIndex, string[] enumValues, string[] displayedValues)

Parameters

position Rect
property SerializedProperty
label GUIContent
startEnumIndex int
enumValues string[]
displayedValues string[]

DrawIntEnum(Rect, SerializedProperty, GUIContent, int, string[])

Used to draw an array of strings in the form of a selectable dropdown. Applied to int property.

It uses a GUILabel object that is overwritten in a specific OnGUI method.
protected void DrawIntEnum(Rect position, SerializedProperty property, GUIContent label, int startEnumIndex, string[] enumValues)

Parameters

position Rect
property SerializedProperty
label GUIContent
startEnumIndex int
enumValues string[]

DrawSimpleEnum(Rect, SerializedProperty, GUIContent, ScriptableObject, int, string[])

Used to draw an array of strings in the form of a selectable dropdown. Applied to string property.

Checks whether the provided scriptable object exists.
protected void DrawSimpleEnum(Rect position, SerializedProperty property, GUIContent label, ScriptableObject settings, int startEnumIndex, string[] enumValues)

Parameters

position Rect
property SerializedProperty
label GUIContent
settings ScriptableObject
startEnumIndex int
enumValues string[]

DrawSimpleEnum(Rect, SerializedProperty, GUIContent, ScriptableObject, int, string[], string[])

Used to draw an array of strings in the form of a selectable dropdown. Applied to string property.

Checks whether the provided scriptable object exists. The fields in the dropdown will have the name as given in the additional label array
protected void DrawSimpleEnum(Rect position, SerializedProperty property, GUIContent label, ScriptableObject settings, int startEnumIndex, string[] enumValues, string[] displayedValues)

Parameters

position Rect
property SerializedProperty
label GUIContent
settings ScriptableObject
startEnumIndex int
enumValues string[]
displayedValues string[]

GetPropertyNameForEmbeddedVariables(SerializedProperty, string)

Algorithm for transforming an extended property path into a proper property name.

The name of the field in the component.
protected string GetPropertyNameForEmbeddedVariables(SerializedProperty property, string attributeVariableName)

Parameters

property SerializedProperty
attributeVariableName string

Returns

string

GetPropertyStringValue(Rect, SerializedProperty, string)

Returns a string value of a given SerializedProperty for a provided component field name.

The name of the field in the component for which the value is searched.
protected string GetPropertyStringValue(Rect position, SerializedProperty property, string attributeVariableName)

Parameters

position Rect
property SerializedProperty
attributeVariableName string

Returns

string

GetPropertyStringValue(Rect, SerializedProperty, ScriptableObject, string)

Returns a string value of a given SerializedProperty for a provided component field name, using settings from ScriptableObject.

Checks whether the provided scriptable object exists. The name of the field in the component for which the value is searched.
protected string GetPropertyStringValue(Rect position, SerializedProperty property, ScriptableObject settings, string attributeVariableName)

Parameters

position Rect
property SerializedProperty
settings ScriptableObject
attributeVariableName string

Returns

string