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
-
GUIDrawerPropertyDrawerBasePropertyDrawer
- Derived
- Extension Methods
Properties
EnumIndex
protected int EnumIndex { get; set; }
Property Value
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
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
positionRectpropertySerializedPropertystartEnumIndexintenumValuesstring[]displayedValuesstring[]
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
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
positionRectpropertySerializedPropertylabelGUIContentstartEnumIndexintenumValuesstring[]displayedValuesstring[]
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
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
positionRectpropertySerializedPropertylabelGUIContentsettingsScriptableObjectstartEnumIndexintenumValuesstring[]
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 arrayprotected void DrawSimpleEnum(Rect position, SerializedProperty property, GUIContent label, ScriptableObject settings, int startEnumIndex, string[] enumValues, string[] displayedValues)
Parameters
positionRectpropertySerializedPropertylabelGUIContentsettingsScriptableObjectstartEnumIndexintenumValuesstring[]displayedValuesstring[]
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
propertySerializedPropertyattributeVariableNamestring
Returns
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
positionRectpropertySerializedPropertyattributeVariableNamestring
Returns
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
positionRectpropertySerializedPropertysettingsScriptableObjectattributeVariableNamestring