ExpandableObjectPropertyDrawer Class Referenceabstract

This custom Property drawer provides all ScriptableObject descendants with the option to be displayed as an ObjectField in the inspector, which the user may expanded to show, and edit, the object's details. Any stored Asset, of the appropriate type may be dragged over this control. If a saved asset is NOT specified in the object field, the scriptable object is stored as part of the Scene or PreFab GameObject it is a member of. When expanded, the ScriptableObjects Editor will be drawn "in-line", just below the ObjectField, like a regular member variable. You may customize the editor window, as normal, for any derived type, and it will be displayed in the details section.

Public Member Functions

override float GetPropertyHeight (SerializedProperty property, GUIContent label)
 Invoked by the UnityEditor, this function should not be overridden in descendants.
 
override void OnGUI (Rect position, SerializedProperty property, GUIContent label)
 Function invoked by unity editor to display the SerializedProperty.
 

Static Public Member Functions

static void DrawProperty (Rect position, SerializedProperty property, GUIContent label, System.Type objectType, bool allowSceneObjects, bool allowCreation, params GUILayoutOption[] options)
 Static function use to Draw a serializedProperty using an ExpandableObjectPropertyDrawer
 
static float GetTotalPropertyHeight (SerializedProperty property, GUIContent label, bool propertyAlwaysExpanded=false)
 Get the current height of the property. Changes depending on current foldout state, and propertyAlwaysExpanded parameter.
 

Static Public Attributes

static bool drawDefaultPropertyOverrideBaseClass
 When set to true, the default property drawer will be drawn. This variable is static, meaning each class derived from this one, will have it's own. This can allow the user to control whether or not to use the standard property drawer, via say... an editor preference option.
 

Protected Member Functions

abstract bool AllowCreation ()
 Descendants must override this abstract function to either compute or specify whether to enable the creation of new objects, enabling the create button.
 
abstract bool AllowSceneObjects ()
 Descendants must override this abstract function to either compute or specify whether to allow SceneObjects to be selected.
 
abstract float GetFoldoutPropertyHeight (SerializedProperty property, GUIContent label)
 This function is overridden is descendants to define how tall the foldout-section of the property is. This function will return the same value whether the control is currently folded out, or not.
 
abstract void OnFoldOutGUI (Rect position, SerializedProperty property, GUIContent label)
 Descendants must override this abstract function to specify how to draw the ScriptableObject, when folded out. Similar to a CustomPropertyDrawer OnGUI().
 

Properties

virtual bool DrawDefaultPropertyOverride [get, set]
 Property that defines whether the property should be drawn as an expandable Object, or as a regular Property.
 
+ Inheritance diagram for ExpandableObjectPropertyDrawer: