Wanzyee Studio
ObjectDrawer

UnityEditor.CustomPropertyDrawer for UnityEngine.Object. More...

Inherits PropertyDrawer.

Public Member Functions

override void OnGUI (Rect position, SerializedProperty property, GUIContent label)
 OnGUI, draw inspector of the property. More...
 

Static Public Member Functions

static Object ObjectField (Rect position, Object obj, Type objType=null, bool allowSceneObjects=true)
 Draw the enhance object field without the prefix label. More...
 

Detailed Description

UnityEditor.CustomPropertyDrawer for UnityEngine.Object.

Enhance the object field support to:

  1. Drag the object, useful when assign multiple fields, e.g., event chain.
  2. Open an auxiliary Inspector for quick view and edit when press "Ctrl" and click.
  3. Tooltip of the object, helpful for small fields, press "Ctrl" to include hierarchy and asset path.

Member Function Documentation

static Object ObjectField ( Rect  position,
Object  obj,
Type  objType = null,
bool  allowSceneObjects = true 
)
static

Draw the enhance object field without the prefix label.

Parameters
positionRectangle on the screen to use for the field.
objThe object the field shows.
objTypeThe type of the objects that can be assigned.
allowSceneObjectsAllow assigning Scene objects.
Returns
The object that has been set by the user.
override void OnGUI ( Rect  position,
SerializedProperty  property,
GUIContent  label 
)

OnGUI, draw inspector of the property.

Parameters
positionPosition.
propertyProperty.
labelLabel.